mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 12:16:03 +09:00
feat(capi-operator): update cluster-api-operator to v0.30.0
cluster-api-operator v0.19 refuses providers whose metadata declares contracts other than v1alpha4 or v1beta1. v0.30 supports Cluster API v1.14 and accepts v1beta1 providers alongside a v1beta2 core. The operator.cluster.x-k8s.io/v1alpha1 API was removed in v0.20.0; every provider object here already uses v1alpha2. Keep existing host-address and global feature-gate overrides effective across the chart upgrade. Explicit per-provider gate maps take priority, including false gates and empty maps. Provider-only configuration must remain under spec, and fetch overrides must not rely on duplicate YAML keys. Profiling settings remain independent of leader election. Retain the one-minute resync workaround until restart recovery is measured independently. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
24 files changed
+2325
-7056
No files matched your search
@@ -11,6 +11,10 @@ load test_helper
|
||||
REPO_ROOT="$(cd "$(dirname "${BATS_TEST_FILENAME:-$0}")/.." && pwd)"
|
||||
OPERATOR="$REPO_ROOT/packages/system/capi-operator"
|
||||
|
||||
@test "the operator chart declares its vendored dependencies" {
|
||||
helm lint "$OPERATOR"
|
||||
}
|
||||
|
||||
@test "the operator manager runs with a one-minute resync period" {
|
||||
local rendered args
|
||||
rendered="$BATS_TEST_TMPDIR/operator.yaml"
|
||||
@@ -23,3 +27,473 @@ OPERATOR="$REPO_ROOT/packages/system/capi-operator"
|
||||
esac
|
||||
printf '%s\n' "$args" | grep -qx -- '--sync-period=1m' || { echo "manager args: $args" >&2; return 1; }
|
||||
}
|
||||
|
||||
check_feature_gate() {
|
||||
local expected="$1" mode="$2" group provider legacy kind rendered actual failed=0
|
||||
local -a flags
|
||||
for entry in 'core cluster-api core CoreProvider' \
|
||||
'controlPlane kubeadm kubeadm ControlPlaneProvider' \
|
||||
'infrastructure docker docker InfrastructureProvider' \
|
||||
'ipam in-cluster in-cluster IPAMProvider'; do
|
||||
read -r group provider legacy kind <<< "$entry"
|
||||
flags=(--set "cluster-api-operator.$group.$provider.version=v1.13.7")
|
||||
case "$mode" in
|
||||
global)
|
||||
flags+=(--set "cluster-api-operator.manager.featureGates.$legacy.ClusterTopology=true")
|
||||
;;
|
||||
provider)
|
||||
flags+=(--set "cluster-api-operator.$group.$provider.manager.featureGates.ClusterTopology=true")
|
||||
;;
|
||||
false)
|
||||
flags+=(--set "cluster-api-operator.manager.featureGates.$legacy.ClusterTopology=true"
|
||||
--set "cluster-api-operator.$group.$provider.manager.featureGates.ClusterTopology=false")
|
||||
;;
|
||||
empty)
|
||||
flags+=(--set "cluster-api-operator.manager.featureGates.$legacy.ClusterTopology=true"
|
||||
--set-json "cluster-api-operator.$group.$provider.manager.featureGates={}")
|
||||
;;
|
||||
esac
|
||||
rendered="$BATS_TEST_TMPDIR/$kind.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api "${flags[@]}" > "$rendered"
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.manager.featureGates.ClusterTopology" "$rendered")"
|
||||
[ "$actual" = "$expected" ] || {
|
||||
echo "$kind $mode: expected $expected, got $actual" >&2
|
||||
failed=1
|
||||
}
|
||||
done
|
||||
[ "$failed" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "legacy global feature gates remain effective for provider kinds" {
|
||||
check_feature_gate true global
|
||||
}
|
||||
|
||||
@test "provider feature gates work without a legacy global value" {
|
||||
check_feature_gate true provider
|
||||
}
|
||||
|
||||
@test "an explicit false provider gate overrides the global gate" {
|
||||
check_feature_gate false false
|
||||
}
|
||||
|
||||
@test "an explicitly empty provider gate map replaces global gates" {
|
||||
check_feature_gate null empty
|
||||
}
|
||||
|
||||
check_auto_kubeadm_gate() {
|
||||
local expected="$1" rendered actual
|
||||
shift
|
||||
rendered="$BATS_TEST_TMPDIR/automatic-control-plane.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.infrastructure.docker.version=v1.13.7 \
|
||||
--set cluster-api-operator.configSecret.name=provider-config \
|
||||
"$@" > "$rendered"
|
||||
actual="$(yq --no-doc 'select(.kind == "ControlPlaneProvider") | .spec.manager.featureGates.ClusterTopology' "$rendered")"
|
||||
[ "$actual" = "$expected" ] || {
|
||||
echo "automatic kubeadm gate: expected $expected, got $actual" >&2
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@test "automatic kubeadm control plane retains the legacy global gate" {
|
||||
check_auto_kubeadm_gate true \
|
||||
--set cluster-api-operator.manager.featureGates.kubeadm.ClusterTopology=true
|
||||
}
|
||||
|
||||
@test "automatic kubeadm control plane does not manufacture a feature gate" {
|
||||
check_auto_kubeadm_gate null
|
||||
}
|
||||
|
||||
@test "explicit kubeadm false gate supersedes automatic global defaults" {
|
||||
check_auto_kubeadm_gate false \
|
||||
--set cluster-api-operator.manager.featureGates.kubeadm.ClusterTopology=true \
|
||||
--set cluster-api-operator.controlPlane.kubeadm.version=v1.13.7 \
|
||||
--set cluster-api-operator.controlPlane.kubeadm.manager.featureGates.ClusterTopology=false
|
||||
}
|
||||
|
||||
@test "explicit kubeadm empty gate map supersedes automatic global defaults" {
|
||||
check_auto_kubeadm_gate null \
|
||||
--set cluster-api-operator.manager.featureGates.kubeadm.ClusterTopology=true \
|
||||
--set cluster-api-operator.controlPlane.kubeadm.version=v1.13.7 \
|
||||
--set-json 'cluster-api-operator.controlPlane.kubeadm.manager.featureGates={}'
|
||||
}
|
||||
|
||||
@test "automatic core and bootstrap keep their existing gate-free defaults" {
|
||||
local rendered actual
|
||||
rendered="$BATS_TEST_TMPDIR/automatic-defaults.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.infrastructure.docker.version=v1.13.7 \
|
||||
--set cluster-api-operator.configSecret.name=provider-config \
|
||||
--set cluster-api-operator.manager.featureGates.core.ClusterTopology=true \
|
||||
--set cluster-api-operator.manager.featureGates.kubeadm.ClusterTopology=true > "$rendered"
|
||||
actual="$(yq --no-doc 'select(.kind == "CoreProvider") | .spec.manager.featureGates' "$rendered")"
|
||||
[ "$actual" = null ]
|
||||
actual="$(yq --no-doc 'select(.kind == "BootstrapProvider") | .spec.manager.featureGates' "$rendered")"
|
||||
[ "$actual" = null ]
|
||||
}
|
||||
|
||||
@test "explicit bootstrap retains its own manager gate" {
|
||||
local rendered actual
|
||||
rendered="$BATS_TEST_TMPDIR/bootstrap.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.bootstrap.kubeadm.version=v1.13.7 \
|
||||
--set cluster-api-operator.bootstrap.kubeadm.manager.featureGates.ClusterTopology=true > "$rendered"
|
||||
actual="$(yq --no-doc 'select(.kind == "BootstrapProvider") | .spec.manager.featureGates.ClusterTopology' "$rendered")"
|
||||
[ "$actual" = true ]
|
||||
}
|
||||
|
||||
@test "addon retains its supported manager metrics without a legacy gate" {
|
||||
local rendered actual
|
||||
rendered="$BATS_TEST_TMPDIR/addon.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.addon.example.version=v1.13.7 \
|
||||
--set cluster-api-operator.addon.example.manager.metrics.diagnosticsAddress=:8443 \
|
||||
--set cluster-api-operator.manager.featureGates.example.ClusterTopology=true > "$rendered"
|
||||
actual="$(yq --no-doc 'select(.kind == "AddonProvider") | .spec.manager.metrics.diagnosticsAddress' "$rendered")"
|
||||
[ "$actual" = ':8443' ]
|
||||
actual="$(yq --no-doc 'select(.kind == "AddonProvider") | .spec.manager.featureGates' "$rendered")"
|
||||
[ "$actual" = null ]
|
||||
}
|
||||
|
||||
check_provider_spec_field() {
|
||||
local field="$1" group provider kind entry rendered actual expected path failed=0
|
||||
local -a flags
|
||||
for entry in 'core cluster-api CoreProvider' 'bootstrap kubeadm BootstrapProvider' \
|
||||
'controlPlane kubeadm ControlPlaneProvider' 'infrastructure docker InfrastructureProvider' \
|
||||
'ipam in-cluster IPAMProvider' 'addon example AddonProvider'; do
|
||||
read -r group provider kind <<< "$entry"
|
||||
flags=(--set "cluster-api-operator.$group.$provider.createNamespace=false")
|
||||
case "$field" in
|
||||
fetchConfig)
|
||||
flags+=(--set-string "cluster-api-operator.$group.$provider.fetchConfig.selector.matchLabels.example=manifests")
|
||||
path='.spec.fetchConfig.selector.matchLabels.example'
|
||||
expected=manifests
|
||||
;;
|
||||
manifestPatches)
|
||||
flags+=(--set-json "cluster-api-operator.$group.$provider.manifestPatches=[\"kind: Deployment\"]")
|
||||
path='.spec.manifestPatches[0]'
|
||||
expected='kind: Deployment'
|
||||
;;
|
||||
additionalManifests)
|
||||
flags+=(--set-json "cluster-api-operator.$group.$provider.additionalManifests={\"name\":\"extra-manifests\",\"manifests\":\"kind: ConfigMap\"}")
|
||||
path='.spec.additionalManifests.name'
|
||||
expected=extra-manifests
|
||||
;;
|
||||
absent)
|
||||
path='.spec'
|
||||
expected=null
|
||||
;;
|
||||
esac
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-$field.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api "${flags[@]}" > "$rendered"
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | $path" "$rendered")"
|
||||
[ "$actual" = "$expected" ] || {
|
||||
echo "$kind $field: expected $expected in spec, got $actual" >&2
|
||||
failed=1
|
||||
}
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .metadata.$field" "$rendered")"
|
||||
[ "$actual" = null ] || {
|
||||
echo "$kind leaked $field into metadata" >&2
|
||||
failed=1
|
||||
}
|
||||
done
|
||||
[ "$failed" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "fetch configuration alone belongs to every provider spec" {
|
||||
check_provider_spec_field fetchConfig
|
||||
}
|
||||
|
||||
@test "manifest patches alone belong to every provider spec" {
|
||||
check_provider_spec_field manifestPatches
|
||||
}
|
||||
|
||||
@test "additional manifests alone belong to every provider spec" {
|
||||
check_provider_spec_field additionalManifests
|
||||
}
|
||||
|
||||
@test "provider namespace options alone do not manufacture spec fields" {
|
||||
check_provider_spec_field absent
|
||||
}
|
||||
|
||||
@test "legacy global fetch configuration alone stays inside matching provider specs" {
|
||||
local group provider kind entry rendered actual
|
||||
for entry in 'infrastructure docker InfrastructureProvider' 'ipam in-cluster IPAMProvider'; do
|
||||
read -r group provider kind <<< "$entry"
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-global-fetch.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set "cluster-api-operator.$group.$provider.createNamespace=false" \
|
||||
--set-string "cluster-api-operator.fetchConfig.$provider.url=https://example.test/components.yaml" > "$rendered"
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.url" "$rendered")"
|
||||
[ "$actual" = 'https://example.test/components.yaml' ]
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .metadata.fetchConfig" "$rendered")"
|
||||
[ "$actual" = null ]
|
||||
done
|
||||
}
|
||||
|
||||
@test "another provider's global fetch configuration does not create a spec" {
|
||||
local rendered actual
|
||||
rendered="$BATS_TEST_TMPDIR/unmatched-fetch.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.infrastructure.docker.createNamespace=false \
|
||||
--set-string cluster-api-operator.fetchConfig.other.url=https://example.test/components.yaml > "$rendered"
|
||||
actual="$(yq --no-doc 'select(.kind == "InfrastructureProvider") | .spec' "$rendered")"
|
||||
[ "$actual" = null ]
|
||||
}
|
||||
|
||||
@test "infrastructure patches alone belong to the provider spec" {
|
||||
local rendered actual
|
||||
rendered="$BATS_TEST_TMPDIR/infrastructure-patches.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set-string 'cluster-api-operator.infrastructure.docker.patches[0].patch=kind: Deployment' > "$rendered"
|
||||
actual="$(yq --no-doc 'select(.kind == "InfrastructureProvider") | .spec.patches[0].patch' "$rendered")"
|
||||
[ "$actual" = 'kind: Deployment' ]
|
||||
actual="$(yq --no-doc 'select(.kind == "InfrastructureProvider") | .metadata.patches' "$rendered")"
|
||||
[ "$actual" = null ]
|
||||
}
|
||||
|
||||
check_fetch_overlap() {
|
||||
local mode="$1" group provider kind template entry rendered actual expected failed=0
|
||||
local -a flags
|
||||
for entry in 'infrastructure docker InfrastructureProvider infra.yaml' \
|
||||
'ipam in-cluster IPAMProvider ipam.yaml'; do
|
||||
read -r group provider kind template <<< "$entry"
|
||||
flags=(--set "cluster-api-operator.$group.$provider.createNamespace=false"
|
||||
--set-string "cluster-api-operator.fetchConfig.$provider.url=https://legacy.example/components.yaml")
|
||||
case "$mode" in
|
||||
override)
|
||||
flags+=(--set-string "cluster-api-operator.$group.$provider.fetchConfig.url=https://provider.example/components.yaml")
|
||||
expected=https://provider.example/components.yaml
|
||||
;;
|
||||
empty)
|
||||
flags+=(--set-json "cluster-api-operator.$group.$provider.fetchConfig={}")
|
||||
expected=https://legacy.example/components.yaml
|
||||
;;
|
||||
esac
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-overlap-$mode.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api "${flags[@]}" \
|
||||
--show-only "charts/cluster-api-operator/templates/$template" > "$rendered"
|
||||
[ "$(grep -c '^ fetchConfig:' "$rendered")" -eq 1 ] || {
|
||||
echo "$kind $mode must emit exactly one fetchConfig key" >&2
|
||||
failed=1
|
||||
}
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.url" "$rendered")"
|
||||
[ "$actual" = "$expected" ] || {
|
||||
echo "$kind $mode expected $expected, got $actual" >&2
|
||||
failed=1
|
||||
}
|
||||
done
|
||||
[ "$failed" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "nonempty provider fetch configuration overrides global input with one key" {
|
||||
check_fetch_overlap override
|
||||
}
|
||||
|
||||
@test "empty provider fetch configuration retains the legacy global fallback" {
|
||||
check_fetch_overlap empty
|
||||
}
|
||||
|
||||
check_profiling_flags() {
|
||||
local rendered
|
||||
rendered="$BATS_TEST_TMPDIR/profiling.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.profilerAddress=:6061 \
|
||||
--set cluster-api-operator.contentionProfiling=true "$@" > "$rendered"
|
||||
grep -q -- '--profiler-address=localhost:6061' "$rendered"
|
||||
grep -q -- '--contention-profiling=true' "$rendered"
|
||||
grep -q '^[[:space:]]*- containerPort: 6061$' "$rendered"
|
||||
}
|
||||
|
||||
@test "profiling flags remain effective when leader election is disabled" {
|
||||
check_profiling_flags --set cluster-api-operator.leaderElection.enabled=false
|
||||
}
|
||||
|
||||
@test "profiling flags remain effective when the optional leader election block is absent" {
|
||||
check_profiling_flags --set-json cluster-api-operator.leaderElection=null
|
||||
}
|
||||
|
||||
check_global_fetch_type() {
|
||||
local mode="$1" group provider kind template entry rendered actual failed=0
|
||||
local -a flags
|
||||
for entry in 'infrastructure docker InfrastructureProvider infra.yaml' \
|
||||
'ipam in-cluster IPAMProvider ipam.yaml'; do
|
||||
read -r group provider kind template <<< "$entry"
|
||||
flags=(--set "cluster-api-operator.$group.$provider.createNamespace=false")
|
||||
case "$mode" in
|
||||
selector)
|
||||
flags+=(--set-json "cluster-api-operator.fetchConfig.$provider.selector={\"matchLabels\":{\"example\":\"manifests\"},\"matchExpressions\":[{\"key\":\"release\",\"operator\":\"In\",\"values\":[\"v1\"]}]}")
|
||||
;;
|
||||
empty)
|
||||
flags+=(--set-json "cluster-api-operator.fetchConfig.$provider.selector={}")
|
||||
;;
|
||||
oci)
|
||||
flags+=(--set-string "cluster-api-operator.fetchConfig.$provider.oci=oci://registry.example/provider:v1")
|
||||
;;
|
||||
esac
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-fetch-type-$mode.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api "${flags[@]}" \
|
||||
--show-only "charts/cluster-api-operator/templates/$template" > "$rendered"
|
||||
[ "$(grep -c '^ fetchConfig:' "$rendered")" -eq 1 ]
|
||||
if [ "$mode" = oci ]; then
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.oci" "$rendered")"
|
||||
[ "$actual" = 'oci://registry.example/provider:v1' ]
|
||||
continue
|
||||
fi
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.selector | tag" "$rendered")"
|
||||
if [ "$actual" != '!!map' ]; then
|
||||
echo "$kind $mode selector must be an object, got $actual" >&2
|
||||
failed=1
|
||||
continue
|
||||
fi
|
||||
if [ "$mode" = selector ]; then
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.selector.matchLabels.example" "$rendered")"
|
||||
[ "$actual" = manifests ]
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.selector.matchExpressions[0].key" "$rendered")"
|
||||
[ "$actual" = release ]
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.selector.matchExpressions[0].operator" "$rendered")"
|
||||
[ "$actual" = In ]
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig.selector.matchExpressions[0].values[0]" "$rendered")"
|
||||
[ "$actual" = v1 ]
|
||||
fi
|
||||
done
|
||||
[ "$failed" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "global fetch selectors preserve nested label and expression objects" {
|
||||
check_global_fetch_type selector
|
||||
}
|
||||
|
||||
@test "empty global fetch selectors remain objects rather than strings" {
|
||||
check_global_fetch_type empty
|
||||
}
|
||||
|
||||
@test "global OCI fetch configuration remains a string source" {
|
||||
check_global_fetch_type oci
|
||||
}
|
||||
|
||||
check_global_fetch_entry() {
|
||||
local value="$1" expected="$2" group provider kind template entry rendered actual failed=0
|
||||
for entry in 'infrastructure docker InfrastructureProvider infra.yaml' \
|
||||
'ipam in-cluster IPAMProvider ipam.yaml'; do
|
||||
read -r group provider kind template <<< "$entry"
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-entry.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set "cluster-api-operator.$group.$provider.version=v1.13.7" \
|
||||
--set-json "cluster-api-operator.fetchConfig.$provider=$value" \
|
||||
--show-only "charts/cluster-api-operator/templates/$template" > "$rendered"
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.fetchConfig | tag" "$rendered")"
|
||||
[ "$actual" = "$expected" ] || {
|
||||
echo "$kind global entry $value: expected $expected, got $actual" >&2
|
||||
failed=1
|
||||
}
|
||||
done
|
||||
[ "$failed" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "empty global fetch entries preserve default source selection" {
|
||||
check_global_fetch_entry '{}' '!!null'
|
||||
}
|
||||
|
||||
@test "null global fetch entries preserve default source selection" {
|
||||
check_global_fetch_entry null '!!null'
|
||||
}
|
||||
|
||||
@test "malformed global fetch primitives are not silently replaced by a default source" {
|
||||
check_global_fetch_entry false '!!bool'
|
||||
check_global_fetch_entry 0 '!!int'
|
||||
check_global_fetch_entry '"invalid"' '!!str'
|
||||
check_global_fetch_entry '[]' '!!seq'
|
||||
}
|
||||
|
||||
check_provider_scalar_types() {
|
||||
local mode="$1" metrics="$2" name="$3" namespace="$4" expected="$5"
|
||||
local group provider kind entry rendered path actual failed=0
|
||||
local -a flags
|
||||
for entry in 'core cluster-api CoreProvider' 'bootstrap kubeadm BootstrapProvider' \
|
||||
'controlPlane kubeadm ControlPlaneProvider' 'infrastructure docker InfrastructureProvider' \
|
||||
'ipam in-cluster IPAMProvider' 'addon example AddonProvider'; do
|
||||
read -r group provider kind <<< "$entry"
|
||||
flags=("--set-$mode" "cluster-api-operator.$group.$provider.manager.metrics.diagnosticsAddress=$metrics"
|
||||
"--set-$mode" "cluster-api-operator.$group.$provider.configSecret.name=$name"
|
||||
"--set-$mode" "cluster-api-operator.$group.$provider.configSecret.namespace=$namespace")
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-scalars-$mode.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api "${flags[@]}" > "$rendered"
|
||||
for path in manager.metrics.diagnosticsAddress configSecret.name configSecret.namespace; do
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.$path | tag" "$rendered")"
|
||||
[ "$actual" = "$expected" ] || {
|
||||
echo "$kind $path: expected YAML type $expected, got $actual" >&2
|
||||
failed=1
|
||||
}
|
||||
done
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.manager.metrics.diagnosticsAddress" "$rendered")"
|
||||
[ "$actual" = "$metrics" ]
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.configSecret.name" "$rendered")"
|
||||
[ "$actual" = "$name" ]
|
||||
actual="$(yq --no-doc "select(.kind == \"$kind\") | .spec.configSecret.namespace" "$rendered")"
|
||||
[ "$actual" = "$namespace" ]
|
||||
done
|
||||
[ "$failed" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "provider metric disable values and numeric secret identifiers stay strings" {
|
||||
check_provider_scalar_types string 0 123 456 '!!str'
|
||||
}
|
||||
|
||||
@test "provider secret identifiers that resemble YAML keywords stay strings" {
|
||||
check_provider_scalar_types string 0 true null '!!str'
|
||||
}
|
||||
|
||||
@test "invalid numeric provider string inputs are not coerced into valid strings" {
|
||||
check_provider_scalar_types json 123 123 456 '!!int'
|
||||
}
|
||||
|
||||
@test "invalid boolean provider string inputs are not coerced into valid strings" {
|
||||
check_provider_scalar_types json true true true '!!bool'
|
||||
}
|
||||
|
||||
@test "provider config Secrets override global defaults" {
|
||||
local group provider kind rendered entry
|
||||
for entry in 'core cluster-api CoreProvider' 'bootstrap kubeadm BootstrapProvider' \
|
||||
'controlPlane kubeadm ControlPlaneProvider' 'infrastructure docker InfrastructureProvider' \
|
||||
'ipam in-cluster IPAMProvider' 'addon example AddonProvider'; do
|
||||
read -r group provider kind <<< "$entry"
|
||||
rendered="$BATS_TEST_TMPDIR/$kind-secret-precedence.yaml"
|
||||
helm template capi-operator "$OPERATOR" \
|
||||
--set cluster-api-operator.configSecret.name=global-config \
|
||||
--set cluster-api-operator.configSecret.namespace=global-namespace \
|
||||
--set "cluster-api-operator.$group.$provider.configSecret.name=provider-config" \
|
||||
--set "cluster-api-operator.$group.$provider.configSecret.namespace=provider-namespace" > "$rendered"
|
||||
[ "$(yq --no-doc "select(.kind == \"$kind\") | .spec.configSecret.name" "$rendered")" = provider-config ]
|
||||
[ "$(yq --no-doc "select(.kind == \"$kind\") | .spec.configSecret.namespace" "$rendered")" = provider-namespace ]
|
||||
done
|
||||
}
|
||||
|
||||
@test "operator profiling preserves an explicit host address" {
|
||||
local rendered="$BATS_TEST_TMPDIR/profiler-host.yaml"
|
||||
helm template capi-operator "$OPERATOR" \
|
||||
--set cluster-api-operator.profilerAddress=127.0.0.1:6061 > "$rendered"
|
||||
grep --quiet --fixed-strings -- '--profiler-address=127.0.0.1:6061' "$rendered"
|
||||
}
|
||||
|
||||
@test "operator ports retain port-only addresses" {
|
||||
local rendered
|
||||
rendered="$BATS_TEST_TMPDIR/operator.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.healthAddr=:9440 \
|
||||
--set cluster-api-operator.diagnosticsAddress=:8443 > "$rendered"
|
||||
[ "$(grep -c '^[[:space:]]*port: 9440$' "$rendered")" -eq 2 ]
|
||||
grep -q '^[[:space:]]*- containerPort: 8443$' "$rendered"
|
||||
}
|
||||
|
||||
@test "operator ports preserve explicit IPv4 host addresses" {
|
||||
local rendered
|
||||
rendered="$BATS_TEST_TMPDIR/operator.yaml"
|
||||
helm template capi-operator "$OPERATOR" --namespace cozy-cluster-api \
|
||||
--set cluster-api-operator.healthAddr=0.0.0.0:9440 \
|
||||
--set cluster-api-operator.diagnosticsAddress=0.0.0.0:8443 > "$rendered"
|
||||
[ "$(grep -c '^[[:space:]]*port: 9440$' "$rendered")" -eq 2 ]
|
||||
grep -q '^[[:space:]]*- containerPort: 8443$' "$rendered"
|
||||
grep -q -- '--health-addr=0.0.0.0:9440' "$rendered"
|
||||
grep -q -- '--diagnostics-address=0.0.0.0:8443' "$rendered"
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
apiVersion: v2
|
||||
name: cozy-capi-operator
|
||||
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
|
||||
dependencies:
|
||||
- name: cluster-api-operator
|
||||
version: "*"
|
||||
repository: "file://charts/cluster-api-operator"
|
||||
@@ -3,7 +3,7 @@ export NAMESPACE=cozy-cluster-api
|
||||
export REPO_NAME=capi-operator
|
||||
export REPO_URL=https://kubernetes-sigs.github.io/cluster-api-operator
|
||||
export CHART_NAME=cluster-api-operator
|
||||
export CHART_VERSION=^0.19
|
||||
export CHART_VERSION=0.30.0
|
||||
|
||||
include ../../../hack/package.mk
|
||||
|
||||
@@ -12,3 +12,9 @@ update: clean capi-operator-update
|
||||
# The upstream chart has no value for --sync-period; values.yaml explains
|
||||
# why we set it.
|
||||
patch -p1 < patches/sync-period.diff
|
||||
patch -p1 < patches/legacy-feature-gates.diff
|
||||
patch -p1 < patches/provider-spec-guards.diff
|
||||
patch -p1 < patches/fetch-config-precedence.diff
|
||||
patch -p1 < patches/profiling-independent.diff
|
||||
patch -p1 < patches/fetch-config-types.diff
|
||||
patch -p1 < patches/provider-string-types.diff
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
appVersion: 0.19.0
|
||||
appVersion: 0.30.0
|
||||
description: Cluster API Operator
|
||||
name: cluster-api-operator
|
||||
type: application
|
||||
version: 0.19.0
|
||||
version: 0.30.0
|
||||
@@ -22,3 +22,13 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "capi-operator.configSecret" -}}
|
||||
{{- $ := .ROOT -}}
|
||||
{{- $arg := .ARGUMENT -}}
|
||||
configSecret:
|
||||
name: {{ default (($.Values).configSecret).name (($arg).configSecret).name | toYaml }}
|
||||
{{- if (default (($.Values).configSecret).namespace (($arg).configSecret).namespace) }}
|
||||
namespace: {{ default (($.Values).configSecret).namespace (($arg).configSecret).namespace | toYaml }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -3,6 +3,7 @@
|
||||
{{- $addonNamespace := default ( printf "%s-%s" $name "addon-system" ) (get $addon "namespace") }}
|
||||
{{- $addonName := $name }}
|
||||
{{- $addonVersion := get $addon "version" }}
|
||||
{{- if ne $addon.createNamespace false }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
@@ -14,6 +15,7 @@ metadata:
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "1"
|
||||
name: {{ $addonNamespace }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
kind: AddonProvider
|
||||
@@ -26,12 +28,30 @@ metadata:
|
||||
"helm.sh/hook-weight": "2"
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- if or $addonVersion $.Values.secretName }}
|
||||
{{- if or $addonVersion $.Values.secretName $.Values.secretNamespace $.Values.configSecret.name $addon.manager $addon.deployment (($addon).configSecret).name $addon.fetchConfig $addon.manifestPatches $addon.additionalManifests }}
|
||||
spec:
|
||||
{{- end}}
|
||||
{{- if $addon.deployment }}
|
||||
deployment: {{ toYaml $addon.deployment | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $addon.manager }}
|
||||
manager:
|
||||
{{- if $addon.manager.metrics }}
|
||||
metrics:
|
||||
{{- if $addon.manager.metrics.insecureDiagnostics }}
|
||||
insecureDiagnostics: {{ $addon.manager.metrics.insecureDiagnostics }}
|
||||
{{- end }}
|
||||
{{- if $addon.manager.metrics.diagnosticsAddress }}
|
||||
diagnosticsAddress: {{ $addon.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $addonVersion }}
|
||||
version: {{ $addonVersion }}
|
||||
{{- end }}
|
||||
{{- if (default (($addon).configSecret).name (($.Values).configSecret).name) }}
|
||||
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $addon) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.secretName }}
|
||||
secretName: {{ $.Values.secretName }}
|
||||
{{- end }}
|
||||
@@ -41,6 +61,9 @@ spec:
|
||||
{{- if $addon.manifestPatches }}
|
||||
manifestPatches: {{ toYaml $addon.manifestPatches | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $addon.fetchConfig }}
|
||||
fetchConfig: {{ toYaml $addon.fetchConfig | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $addon.additionalManifests }}
|
||||
additionalManifests:
|
||||
name: {{ $addon.additionalManifests.name }}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{{- $bootstrapNamespace := default ( printf "%s-%s" $name "bootstrap-system" ) (get $bootstrap "namespace") }}
|
||||
{{- $bootstrapName := $name }}
|
||||
{{- $bootstrapVersion := get $bootstrap "version" }}
|
||||
{{- if ne $bootstrap.createNamespace false }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
@@ -14,6 +15,7 @@ metadata:
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "1"
|
||||
name: {{ $bootstrapNamespace }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
kind: BootstrapProvider
|
||||
@@ -26,22 +28,42 @@ metadata:
|
||||
"helm.sh/hook-weight": "2"
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- if or $bootstrapVersion $.Values.configSecret.name }}
|
||||
{{- if or $bootstrapVersion $.Values.configSecret.name $bootstrap.manager $bootstrap.deployment (($bootstrap).configSecret).name $bootstrap.fetchConfig $bootstrap.manifestPatches $bootstrap.additionalManifests }}
|
||||
spec:
|
||||
{{- end}}
|
||||
{{- if $bootstrap.deployment }}
|
||||
deployment: {{ toYaml $bootstrap.deployment | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $bootstrap.manager }}
|
||||
manager:
|
||||
{{- if $bootstrap.manager.featureGates }}
|
||||
featureGates:
|
||||
{{- range $key, $value := $bootstrap.manager.featureGates }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $bootstrap.manager.metrics }}
|
||||
metrics:
|
||||
{{- if $bootstrap.manager.metrics.insecureDiagnostics }}
|
||||
insecureDiagnostics: {{ $bootstrap.manager.metrics.insecureDiagnostics }}
|
||||
{{- end }}
|
||||
{{- if $bootstrap.manager.metrics.diagnosticsAddress }}
|
||||
diagnosticsAddress: {{ $bootstrap.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $bootstrapVersion }}
|
||||
version: {{ $bootstrapVersion }}
|
||||
{{- end }}
|
||||
{{- if $.Values.configSecret.name }}
|
||||
configSecret:
|
||||
name: {{ $.Values.configSecret.name }}
|
||||
{{- if $.Values.configSecret.namespace }}
|
||||
namespace: {{ $.Values.configSecret.namespace }}
|
||||
{{- end }}
|
||||
{{- if (default (($bootstrap).configSecret).name (($.Values).configSecret).name) }}
|
||||
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $bootstrap) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- if $bootstrap.manifestPatches }}
|
||||
manifestPatches: {{ toYaml $bootstrap.manifestPatches | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $bootstrap.fetchConfig }}
|
||||
fetchConfig: {{ toYaml $bootstrap.fetchConfig | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $bootstrap.additionalManifests }}
|
||||
additionalManifests:
|
||||
name: {{ $bootstrap.additionalManifests.name }}
|
||||
|
||||
+25
-15
@@ -1,8 +1,10 @@
|
||||
# Control plane provider
|
||||
{{- range $name, $controlPlane := $.Values.controlPlane }}
|
||||
{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $controlPlane "key" $name) }}
|
||||
{{- $controlPlaneNamespace := default ( printf "%s-%s" $name "control-plane-system" ) (get $controlPlane "namespace") }}
|
||||
{{- $controlPlaneName := $name }}
|
||||
{{- $controlPlaneVersion := get $controlPlane "version" }}
|
||||
{{- if ne $controlPlane.createNamespace false }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
@@ -14,6 +16,7 @@ metadata:
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "1"
|
||||
name: {{ $controlPlaneNamespace }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
kind: ControlPlaneProvider
|
||||
@@ -26,35 +29,42 @@ metadata:
|
||||
"helm.sh/hook-weight": "2"
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- if or $controlPlaneVersion $.Values.configSecret.name $.Values.manager }}
|
||||
{{- if or $controlPlaneVersion $.Values.configSecret.name $controlPlane.manager $controlPlane.deployment (($controlPlane).configSecret).name $controlPlane.fetchConfig $controlPlane.manifestPatches $controlPlane.additionalManifests }}
|
||||
spec:
|
||||
{{- end}}
|
||||
{{- if $controlPlaneVersion }}
|
||||
version: {{ $controlPlaneVersion }}
|
||||
{{- end }}
|
||||
{{- if $.Values.manager }}
|
||||
{{- if hasKey $.Values.manager.featureGates $controlPlaneName }}
|
||||
{{- if $controlPlane.deployment }}
|
||||
deployment: {{ toYaml $controlPlane.deployment | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $controlPlane.manager }}
|
||||
manager:
|
||||
{{- range $key, $value := $.Values.manager.featureGates }}
|
||||
{{- if eq $key $controlPlaneName }}
|
||||
{{- if $controlPlane.manager.featureGates }}
|
||||
featureGates:
|
||||
{{- range $k, $v := $value }}
|
||||
{{ $k }}: {{ $v }}
|
||||
{{- range $key, $value := $controlPlane.manager.featureGates }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $controlPlane.manager.metrics }}
|
||||
metrics:
|
||||
{{- if $controlPlane.manager.metrics.insecureDiagnostics }}
|
||||
insecureDiagnostics: {{ $controlPlane.manager.metrics.insecureDiagnostics }}
|
||||
{{- end }}
|
||||
{{- if $controlPlane.manager.metrics.diagnosticsAddress }}
|
||||
diagnosticsAddress: {{ $controlPlane.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.configSecret.name }}
|
||||
configSecret:
|
||||
name: {{ $.Values.configSecret.name }}
|
||||
{{- if $.Values.configSecret.namespace }}
|
||||
namespace: {{ $.Values.configSecret.namespace }}
|
||||
{{- end }}
|
||||
{{- if (default (($controlPlane).configSecret).name (($.Values).configSecret).name) }}
|
||||
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $controlPlane) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- if $controlPlane.manifestPatches }}
|
||||
manifestPatches: {{ toYaml $controlPlane.manifestPatches | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $controlPlane.fetchConfig }}
|
||||
fetchConfig: {{ toYaml $controlPlane.fetchConfig | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $controlPlane.additionalManifests }}
|
||||
additionalManifests:
|
||||
name: {{ $controlPlane.additionalManifests.name }}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# Core provider
|
||||
{{- range $name, $core := $.Values.core }}
|
||||
{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $core "key" "core") }}
|
||||
{{- $coreNamespace := default "capi-system" (get $core "namespace") }}
|
||||
{{- $coreName := $name }}
|
||||
{{- $coreVersion := get $core "version" }}
|
||||
{{- if ne $core.createNamespace false }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
@@ -14,6 +16,7 @@ metadata:
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "1"
|
||||
name: {{ $coreNamespace }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
kind: CoreProvider
|
||||
@@ -26,31 +29,42 @@ metadata:
|
||||
"helm.sh/hook-weight": "2"
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- if or $coreVersion $.Values.configSecret.name $.Values.manager }}
|
||||
{{- if or $coreVersion $.Values.configSecret.name $core.manager $core.deployment (($core).configSecret).name $core.fetchConfig $core.manifestPatches $core.additionalManifests }}
|
||||
spec:
|
||||
{{- end}}
|
||||
{{- if $coreVersion }}
|
||||
version: {{ $coreVersion }}
|
||||
{{- end }}
|
||||
{{- if $.Values.manager }}
|
||||
{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.core }}
|
||||
{{- if $core.deployment }}
|
||||
deployment: {{ toYaml $core.deployment | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $core.manager }}
|
||||
manager:
|
||||
{{- if $core.manager.featureGates }}
|
||||
featureGates:
|
||||
{{- range $key, $value := $.Values.manager.featureGates.core }}
|
||||
{{- range $key, $value := $core.manager.featureGates }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.configSecret.name }}
|
||||
configSecret:
|
||||
name: {{ $.Values.configSecret.name }}
|
||||
{{- if $.Values.configSecret.namespace }}
|
||||
namespace: {{ $.Values.configSecret.namespace }}
|
||||
{{- end }}
|
||||
{{- if $core.manager.metrics }}
|
||||
metrics:
|
||||
{{- if $core.manager.metrics.insecureDiagnostics }}
|
||||
insecureDiagnostics: {{ $core.manager.metrics.insecureDiagnostics }}
|
||||
{{- end }}
|
||||
{{- if $core.manager.metrics.diagnosticsAddress }}
|
||||
diagnosticsAddress: {{ $core.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (default (($core).configSecret).name (($.Values).configSecret).name) }}
|
||||
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $core) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- if $core.manifestPatches }}
|
||||
manifestPatches: {{ toYaml $core.manifestPatches | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $core.fetchConfig }}
|
||||
fetchConfig: {{ toYaml $core.fetchConfig | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $core.additionalManifests }}
|
||||
additionalManifests:
|
||||
name: {{ $core.additionalManifests.name }}
|
||||
|
||||
+25
-13
@@ -74,6 +74,9 @@ spec:
|
||||
{{- if .Values.watchConfigSecret }}
|
||||
- --watch-configsecret
|
||||
{{- end }}
|
||||
{{- if .Values.watchConfigMap }}
|
||||
- --watch-configmap
|
||||
{{- end }}
|
||||
{{- with .Values.leaderElection }}
|
||||
- --leader-elect={{ .enabled }}
|
||||
{{- if .leaseDuration }}
|
||||
@@ -86,6 +89,12 @@ spec:
|
||||
- --leader-elect-retry-period={{ .retryPeriod }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.profilerAddress }}
|
||||
- --profiler-address={{ if hasPrefix ":" ($.Values.profilerAddress | toString) }}localhost{{ end }}{{ $.Values.profilerAddress }}
|
||||
{{- end }}
|
||||
{{- if $.Values.contentionProfiling }}
|
||||
- --contention-profiling={{ $.Values.contentionProfiling }}
|
||||
{{- end }}
|
||||
{{- with .Values.syncPeriod }}
|
||||
- --sync-period={{ . }}
|
||||
{{- end }}
|
||||
@@ -97,18 +106,21 @@ spec:
|
||||
imagePullPolicy: {{ .Values.image.manager.pullPolicy }}
|
||||
name: manager
|
||||
ports:
|
||||
{{- if $.Values.profilerAddress }}
|
||||
{{- $profilerPort := $.Values.profilerAddress | toString | splitList ":" | last | int }}
|
||||
- containerPort: {{ $profilerPort }}
|
||||
name: profiler
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
- containerPort: 9443
|
||||
name: webhook-server
|
||||
protocol: TCP
|
||||
{{- if $.Values.diagnosticsAddress }}
|
||||
{{- $diagnosticsPort := $.Values.diagnosticsAddress }}
|
||||
{{- if contains ":" $diagnosticsPort -}}
|
||||
{{ $diagnosticsPort = ( split ":" $.Values.diagnosticsAddress)._1 | int }}
|
||||
{{- end }}
|
||||
- containerPort: {{ $diagnosticsPort | int }}
|
||||
name: metrics
|
||||
{{- if .Values.diagnosticsAddress }}
|
||||
{{- $diagnosticsPort := .Values.diagnosticsAddress | toString | splitList ":" | last | int }}
|
||||
- containerPort: {{ $diagnosticsPort }}
|
||||
name: diagnostics
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.resources.manager }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
@@ -126,15 +138,15 @@ spec:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
terminationMessagePolicy: FallbackToLogsOnError
|
||||
{{- $healthAddr := $.Values.healthAddr }}
|
||||
{{- if contains ":" $healthAddr -}}
|
||||
{{ $healthAddr = ( split ":" $.Values.healthAddr)._1 | int }}
|
||||
{{- $healthPort := 9440 }}
|
||||
{{- if .Values.healthAddr }}
|
||||
{{- $healthPort = .Values.healthAddr | toString | splitList ":" | last | int }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: {{ $healthAddr | default 9440 }}
|
||||
port: {{ $healthPort }}
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
@@ -144,7 +156,7 @@ spec:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: {{ $healthAddr | default 9440 }}
|
||||
port: {{ $healthPort }}
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
+4
-7
@@ -61,14 +61,11 @@ metadata:
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- with .Values.configSecret }}
|
||||
spec:
|
||||
{{- if $.Values.manager }}
|
||||
{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.kubeadm }}
|
||||
{{- $controlPlane := dict }}
|
||||
{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $controlPlane "key" "kubeadm") }}
|
||||
{{- with $controlPlane.manager }}
|
||||
manager:
|
||||
featureGates:
|
||||
{{- range $key, $value := $.Values.manager.featureGates.kubeadm }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
configSecret:
|
||||
name: {{ .name }}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# Infrastructure providers
|
||||
{{- range $name, $infra := $.Values.infrastructure }}
|
||||
{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $infra "key" $name) }}
|
||||
{{- $infrastructureNamespace := default ( printf "%s-%s" $name "infrastructure-system" ) (get $infra "namespace") }}
|
||||
{{- $infrastructureName := $name }}
|
||||
{{- $infrastructureVersion := get $infra "version" }}
|
||||
{{- if ne $infra.createNamespace false }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
@@ -14,6 +16,7 @@ metadata:
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "1"
|
||||
name: {{ $infrastructureNamespace }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
kind: InfrastructureProvider
|
||||
@@ -26,41 +29,44 @@ metadata:
|
||||
"helm.sh/hook-weight": "2"
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- if or $infrastructureVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
|
||||
{{- if or $infrastructureVersion $.Values.configSecret.name $infra.manager $infra.deployment $.Values.additionalDeployments (($infra).configSecret).name $infra.fetchConfig $infra.patches $infra.manifestPatches $infra.additionalManifests (and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName)) }}
|
||||
spec:
|
||||
{{- end }}
|
||||
{{- if $infrastructureVersion }}
|
||||
version: {{ $infrastructureVersion }}
|
||||
{{- end }}
|
||||
{{- if $.Values.manager }}
|
||||
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $infrastructureName) }}
|
||||
{{- if $infra.deployment }}
|
||||
deployment: {{ toYaml $infra.deployment | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $infra.manager }}
|
||||
manager:
|
||||
{{- range $key, $value := $.Values.manager.featureGates }}
|
||||
{{- if eq $key $infrastructureName }}
|
||||
{{- if $infra.manager.featureGates }}
|
||||
featureGates:
|
||||
{{- range $k, $v := $value }}
|
||||
{{ $k }}: {{ $v }}
|
||||
{{- range $key, $value := $infra.manager.featureGates }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $infra.manager.metrics }}
|
||||
metrics:
|
||||
{{- if $infra.manager.metrics.insecureDiagnostics }}
|
||||
insecureDiagnostics: {{ $infra.manager.metrics.insecureDiagnostics }}
|
||||
{{- end }}
|
||||
{{- if $infra.manager.metrics.diagnosticsAddress }}
|
||||
diagnosticsAddress: {{ $infra.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName) }}
|
||||
{{- if and (not $infra.fetchConfig) (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName) }}
|
||||
{{- range $key, $value := $.Values.fetchConfig }}
|
||||
{{- if eq $key $infrastructureName }}
|
||||
fetchConfig:
|
||||
{{- range $k, $v := $value }}
|
||||
{{ $k }}: {{ $v }}
|
||||
{{- end }}
|
||||
{{- if not (or (kindIs "invalid" $value) (and (kindIs "map" $value) (empty $value))) }}
|
||||
fetchConfig: {{- toYaml $value | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.configSecret.name }}
|
||||
configSecret:
|
||||
name: {{ $.Values.configSecret.name }}
|
||||
{{- if $.Values.configSecret.namespace }}
|
||||
namespace: {{ $.Values.configSecret.namespace }}
|
||||
{{- end }}
|
||||
{{- if (default (($infra).configSecret).name (($.Values).configSecret).name) }}
|
||||
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $infra) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.additionalDeployments }}
|
||||
additionalDeployments: {{ toYaml $.Values.additionalDeployments | nindent 4 }}
|
||||
@@ -68,6 +74,12 @@ spec:
|
||||
{{- if $infra.manifestPatches }}
|
||||
manifestPatches: {{- toYaml $infra.manifestPatches | nindent 4 }}
|
||||
{{- end }} {{/* if $infra.manifestPatches */}}
|
||||
{{- if $infra.patches }}
|
||||
patches: {{ toYaml $infra.patches | nindent 4 }}
|
||||
{{- end }} {{/* if $infra.patches */}}
|
||||
{{- if $infra.fetchConfig }}
|
||||
fetchConfig: {{ toYaml $infra.fetchConfig | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $infra.additionalManifests }}
|
||||
additionalManifests:
|
||||
name: {{ $infra.additionalManifests.name }}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# IPAM providers
|
||||
{{- range $name, $ipam := $.Values.ipam }}
|
||||
{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $ipam "key" $name) }}
|
||||
{{- $ipamNamespace := default ( printf "%s-%s" $name "ipam-system" ) (get $ipam "namespace") }}
|
||||
{{- $ipamName := $name }}
|
||||
{{- $ipamVersion := get $ipam "version" }}
|
||||
{{- if ne $ipam.createNamespace false }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
@@ -14,6 +16,7 @@ metadata:
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "1"
|
||||
name: {{ $ipamNamespace }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||||
kind: IPAMProvider
|
||||
@@ -26,35 +29,51 @@ metadata:
|
||||
"helm.sh/hook-weight": "2"
|
||||
{{- end }}
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- if or $ipamVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
|
||||
{{- if or $ipamVersion $.Values.configSecret.name $ipam.manager $ipam.deployment $.Values.additionalDeployments (($ipam).configSecret).name $ipam.fetchConfig $ipam.manifestPatches $ipam.additionalManifests (and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName)) }}
|
||||
spec:
|
||||
{{- end }}
|
||||
{{- if $ipamVersion }}
|
||||
version: {{ $ipamVersion }}
|
||||
{{- end }}
|
||||
{{- if $.Values.manager }}
|
||||
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $ipamName) }}
|
||||
{{- if $ipam.deployment }}
|
||||
deployment: {{ toYaml $ipam.deployment | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $ipam.manager }}
|
||||
manager:
|
||||
{{- range $key, $value := $.Values.manager.featureGates }}
|
||||
{{- if eq $key $ipamName }}
|
||||
{{- if $ipam.manager.featureGates }}
|
||||
featureGates:
|
||||
{{- range $k, $v := $value }}
|
||||
{{ $k }}: {{ $v }}
|
||||
{{- range $key, $value := $ipam.manager.featureGates }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $ipam.manager.metrics }}
|
||||
metrics:
|
||||
{{- if $ipam.manager.metrics.insecureDiagnostics }}
|
||||
insecureDiagnostics: {{ $ipam.manager.metrics.insecureDiagnostics }}
|
||||
{{- end }}
|
||||
{{- if $ipam.manager.metrics.diagnosticsAddress }}
|
||||
diagnosticsAddress: {{ $ipam.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (not $ipam.fetchConfig) (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName) }}
|
||||
{{- range $key, $value := $.Values.fetchConfig }}
|
||||
{{- if eq $key $ipamName }}
|
||||
{{- if not (or (kindIs "invalid" $value) (and (kindIs "map" $value) (empty $value))) }}
|
||||
fetchConfig: {{- toYaml $value | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.configSecret.name }}
|
||||
configSecret:
|
||||
name: {{ $.Values.configSecret.name }}
|
||||
{{- if $.Values.configSecret.namespace }}
|
||||
namespace: {{ $.Values.configSecret.namespace }}
|
||||
{{- end }}
|
||||
{{- if (default (($ipam).configSecret).name (($.Values).configSecret).name) }}
|
||||
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $ipam) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- if $ipam.manifestPatches }}
|
||||
manifestPatches: {{ toYaml $ipam.manifestPatches | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $ipam.fetchConfig }}
|
||||
fetchConfig: {{ toYaml $ipam.fetchConfig | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.additionalDeployments }}
|
||||
additionalDeployments: {{ toYaml $.Values.additionalDeployments | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
+1337
-6942
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,12 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fetchConfig": {
|
||||
"type": "object",
|
||||
"deprecated": true,
|
||||
"description": "This field is deprecated and will be removed in future versions. Prefer declaring fetchConfig under the individual providers instead."
|
||||
},
|
||||
"core": {
|
||||
"oneOf": [
|
||||
{ "type": "object" },
|
||||
|
||||
@@ -2,30 +2,118 @@
|
||||
# ---
|
||||
# Cluster API provider options
|
||||
core: {}
|
||||
# cluster-api: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# cluster-api: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# createNamespace: true # Optional
|
||||
# deployment: # Optional
|
||||
# replicas: 1
|
||||
# nodeSelector: {}
|
||||
# tolerations: []
|
||||
# affinity: {}
|
||||
# containers: []
|
||||
# serviceAccountName: ""
|
||||
# imagePullSecrets: []
|
||||
# manager: # Optional
|
||||
# featureGates:
|
||||
# ClusterTopology: true
|
||||
# metrics:
|
||||
# insecureDiagnostics: true
|
||||
# diagnosticsAddress: localhost:8080
|
||||
bootstrap: {}
|
||||
# kubeadm: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# kubeadm: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# createNamespace: true # Optional
|
||||
# deployment: # Optional
|
||||
# replicas: 1
|
||||
# nodeSelector: {}
|
||||
# tolerations: []
|
||||
# affinity: {}
|
||||
# containers: []
|
||||
# serviceAccountName: ""
|
||||
# imagePullSecrets: []
|
||||
# manager: # Optional
|
||||
# featureGates:
|
||||
# ClusterTopology: true
|
||||
# MachinePool: true
|
||||
# metrics:
|
||||
# insecureDiagnostics: true
|
||||
# diagnosticsAddress: localhost:8080
|
||||
controlPlane: {}
|
||||
# kubeadm: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# kubeadm: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# createNamespace: true # Optional
|
||||
# deployment: # Optional
|
||||
# replicas: 1
|
||||
# nodeSelector: {}
|
||||
# tolerations: []
|
||||
# affinity: {}
|
||||
# containers: []
|
||||
# serviceAccountName: ""
|
||||
# imagePullSecrets: []
|
||||
# manager: # Optional
|
||||
# featureGates:
|
||||
# ClusterTopology: true
|
||||
# metrics:
|
||||
# insecureDiagnostics: true
|
||||
# diagnosticsAddress: localhost:8080
|
||||
infrastructure: {}
|
||||
# docker: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# docker: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# createNamespace: true # Optional
|
||||
# deployment: # Optional
|
||||
# replicas: 1
|
||||
# nodeSelector: {}
|
||||
# tolerations: []
|
||||
# affinity: {}
|
||||
# containers: []
|
||||
# serviceAccountName: ""
|
||||
# imagePullSecrets: []
|
||||
# manager: # Optional
|
||||
# featureGates:
|
||||
# ClusterTopology: true
|
||||
# metrics:
|
||||
# insecureDiagnostics: true
|
||||
# diagnosticsAddress: localhost:8080
|
||||
addon: {}
|
||||
# helm: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# helm: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# createNamespace: true # Optional
|
||||
# deployment: # Optional
|
||||
# replicas: 1
|
||||
# nodeSelector: {}
|
||||
# tolerations: []
|
||||
# affinity: {}
|
||||
# containers: []
|
||||
# serviceAccountName: ""
|
||||
# imagePullSecrets: []
|
||||
# manager: # Optional
|
||||
# metrics:
|
||||
# insecureDiagnostics: true
|
||||
# diagnosticsAddress: localhost:8080
|
||||
ipam: {}
|
||||
# in-cluster: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
manager.featureGates: {}
|
||||
# in-cluster: {} # Name, required
|
||||
# namespace: "" # Optional
|
||||
# version: "" # Optional
|
||||
# createNamespace: true # Optional
|
||||
# deployment: # Optional
|
||||
# replicas: 1
|
||||
# nodeSelector: {}
|
||||
# tolerations: []
|
||||
# affinity: {}
|
||||
# containers: []
|
||||
# serviceAccountName: ""
|
||||
# imagePullSecrets: []
|
||||
# manager: # Optional
|
||||
# featureGates:
|
||||
# ClusterTopology: true
|
||||
# metrics:
|
||||
# insecureDiagnostics: true
|
||||
# diagnosticsAddress: localhost:8080
|
||||
fetchConfig: {}
|
||||
# ---
|
||||
# Common configuration secret options
|
||||
@@ -39,20 +127,23 @@ leaderElection:
|
||||
image:
|
||||
manager:
|
||||
repository: registry.k8s.io/capi-operator/cluster-api-operator
|
||||
tag: v0.19.0
|
||||
tag: v0.30.0
|
||||
pullPolicy: IfNotPresent
|
||||
env:
|
||||
manager: []
|
||||
diagnosticsAddress: ":8443"
|
||||
healthAddr: ":9440"
|
||||
profilerAddress: ":6060"
|
||||
contentionProfiling: false
|
||||
insecureDiagnostics: false
|
||||
watchConfigSecret: false
|
||||
watchConfigMap: false
|
||||
imagePullSecrets: {}
|
||||
resources:
|
||||
manager:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 150Mi
|
||||
memory: 300Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/charts/cluster-api-operator/templates/infra.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/infra.yaml
|
||||
@@ -59,1 +59,1 @@
|
||||
-{{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName) }}
|
||||
+{{- if and (not $infra.fetchConfig) (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName) }}
|
||||
--- a/charts/cluster-api-operator/templates/ipam.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/ipam.yaml
|
||||
@@ -59,1 +59,1 @@
|
||||
-{{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName) }}
|
||||
+{{- if and (not $ipam.fetchConfig) (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName) }}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/charts/cluster-api-operator/templates/infra.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/infra.yaml
|
||||
@@ -62,4 +62,3 @@
|
||||
- fetchConfig:
|
||||
- {{- range $k, $v := $value }}
|
||||
- {{ $k }}: {{ $v }}
|
||||
- {{- end }}
|
||||
+{{- if not (or (kindIs "invalid" $value) (and (kindIs "map" $value) (empty $value))) }}
|
||||
+ fetchConfig: {{- toYaml $value | nindent 4 }}
|
||||
+{{- end }}
|
||||
--- a/charts/cluster-api-operator/templates/ipam.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/ipam.yaml
|
||||
@@ -62,4 +62,3 @@
|
||||
- fetchConfig:
|
||||
- {{- range $k, $v := $value }}
|
||||
- {{ $k }}: {{ $v }}
|
||||
- {{- end }}
|
||||
+{{- if not (or (kindIs "invalid" $value) (and (kindIs "map" $value) (empty $value))) }}
|
||||
+ fetchConfig: {{- toYaml $value | nindent 4 }}
|
||||
+{{- end }}
|
||||
@@ -0,0 +1,51 @@
|
||||
--- a/charts/cluster-api-operator/templates/core.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/core.yaml
|
||||
@@ -1,5 +1,6 @@
|
||||
# Core provider
|
||||
{{- range $name, $core := $.Values.core }}
|
||||
+{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $core "key" "core") }}
|
||||
{{- $coreNamespace := default "capi-system" (get $core "namespace") }}
|
||||
{{- $coreName := $name }}
|
||||
{{- $coreVersion := get $core "version" }}
|
||||
--- a/charts/cluster-api-operator/templates/control-plane.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/control-plane.yaml
|
||||
@@ -1,5 +1,6 @@
|
||||
# Control plane provider
|
||||
{{- range $name, $controlPlane := $.Values.controlPlane }}
|
||||
+{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $controlPlane "key" $name) }}
|
||||
{{- $controlPlaneNamespace := default ( printf "%s-%s" $name "control-plane-system" ) (get $controlPlane "namespace") }}
|
||||
{{- $controlPlaneName := $name }}
|
||||
{{- $controlPlaneVersion := get $controlPlane "version" }}
|
||||
--- a/charts/cluster-api-operator/templates/infra.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/infra.yaml
|
||||
@@ -1,5 +1,6 @@
|
||||
# Infrastructure providers
|
||||
{{- range $name, $infra := $.Values.infrastructure }}
|
||||
+{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $infra "key" $name) }}
|
||||
{{- $infrastructureNamespace := default ( printf "%s-%s" $name "infrastructure-system" ) (get $infra "namespace") }}
|
||||
{{- $infrastructureName := $name }}
|
||||
{{- $infrastructureVersion := get $infra "version" }}
|
||||
--- a/charts/cluster-api-operator/templates/ipam.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/ipam.yaml
|
||||
@@ -1,5 +1,6 @@
|
||||
# IPAM providers
|
||||
{{- range $name, $ipam := $.Values.ipam }}
|
||||
+{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $ipam "key" $name) }}
|
||||
{{- $ipamNamespace := default ( printf "%s-%s" $name "ipam-system" ) (get $ipam "namespace") }}
|
||||
{{- $ipamName := $name }}
|
||||
{{- $ipamVersion := get $ipam "version" }}
|
||||
--- a/charts/cluster-api-operator/templates/infra-conditions.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/infra-conditions.yaml
|
||||
@@ -61,6 +61,12 @@
|
||||
"argocd.argoproj.io/sync-wave": "2"
|
||||
{{- with .Values.configSecret }}
|
||||
spec:
|
||||
+{{- $controlPlane := dict }}
|
||||
+{{- include "cozystack.capi-operator.legacyFeatureGates" (dict "root" $ "provider" $controlPlane "key" "kubeadm") }}
|
||||
+{{- with $controlPlane.manager }}
|
||||
+ manager:
|
||||
+ {{- toYaml . | nindent 4 }}
|
||||
+{{- end }}
|
||||
configSecret:
|
||||
name: {{ .name }}
|
||||
{{- if .namespace }}
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/charts/cluster-api-operator/templates/deployment.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/deployment.yaml
|
||||
@@ -87,14 +87,14 @@
|
||||
{{- end }}
|
||||
{{- if .retryPeriod }}
|
||||
- --leader-elect-retry-period={{ .retryPeriod }}
|
||||
{{- end }}
|
||||
+ {{- end }}
|
||||
{{- if $.Values.profilerAddress }}
|
||||
- --profiler-address={{ if hasPrefix ":" ($.Values.profilerAddress | toString) }}localhost{{ end }}{{ $.Values.profilerAddress }}
|
||||
{{- end }}
|
||||
{{- if $.Values.contentionProfiling }}
|
||||
- --contention-profiling={{ $.Values.contentionProfiling }}
|
||||
{{- end }}
|
||||
- {{- end }}
|
||||
{{- with .Values.syncPeriod }}
|
||||
- --sync-period={{ . }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,30 @@
|
||||
--- a/charts/cluster-api-operator/templates/core.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/core.yaml
|
||||
@@ -32,1 +32,1 @@
|
||||
-{{- if or $coreVersion $.Values.configSecret.name $core.manager $core.deployment (($core).configSecret).name }}
|
||||
+{{- if or $coreVersion $.Values.configSecret.name $core.manager $core.deployment (($core).configSecret).name $core.fetchConfig $core.manifestPatches $core.additionalManifests }}
|
||||
--- a/charts/cluster-api-operator/templates/bootstrap.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/bootstrap.yaml
|
||||
@@ -31,1 +31,1 @@
|
||||
-{{- if or $bootstrapVersion $.Values.configSecret.name $bootstrap.manager $bootstrap.deployment (($bootstrap).configSecret).name }}
|
||||
+{{- if or $bootstrapVersion $.Values.configSecret.name $bootstrap.manager $bootstrap.deployment (($bootstrap).configSecret).name $bootstrap.fetchConfig $bootstrap.manifestPatches $bootstrap.additionalManifests }}
|
||||
--- a/charts/cluster-api-operator/templates/control-plane.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/control-plane.yaml
|
||||
@@ -32,1 +32,1 @@
|
||||
-{{- if or $controlPlaneVersion $.Values.configSecret.name $controlPlane.manager $controlPlane.deployment (($controlPlane).configSecret).name }}
|
||||
+{{- if or $controlPlaneVersion $.Values.configSecret.name $controlPlane.manager $controlPlane.deployment (($controlPlane).configSecret).name $controlPlane.fetchConfig $controlPlane.manifestPatches $controlPlane.additionalManifests }}
|
||||
--- a/charts/cluster-api-operator/templates/infra.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/infra.yaml
|
||||
@@ -32,1 +32,1 @@
|
||||
-{{- if or $infrastructureVersion $.Values.configSecret.name $infra.manager $infra.deployment $.Values.additionalDeployments (($infra).configSecret).name }}
|
||||
+{{- if or $infrastructureVersion $.Values.configSecret.name $infra.manager $infra.deployment $.Values.additionalDeployments (($infra).configSecret).name $infra.fetchConfig $infra.patches $infra.manifestPatches $infra.additionalManifests (and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName)) }}
|
||||
--- a/charts/cluster-api-operator/templates/ipam.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/ipam.yaml
|
||||
@@ -32,1 +32,1 @@
|
||||
-{{- if or $ipamVersion $.Values.configSecret.name $ipam.manager $ipam.deployment $.Values.additionalDeployments (($ipam).configSecret).name }}
|
||||
+{{- if or $ipamVersion $.Values.configSecret.name $ipam.manager $ipam.deployment $.Values.additionalDeployments (($ipam).configSecret).name $ipam.fetchConfig $ipam.manifestPatches $ipam.additionalManifests (and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName)) }}
|
||||
--- a/charts/cluster-api-operator/templates/addon.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/addon.yaml
|
||||
@@ -31,1 +31,1 @@
|
||||
-{{- if or $addonVersion $.Values.secretName $.Values.configSecret.name $addon.manager $addon.deployment (($addon).configSecret).name }}
|
||||
+{{- if or $addonVersion $.Values.secretName $.Values.secretNamespace $.Values.configSecret.name $addon.manager $addon.deployment (($addon).configSecret).name $addon.fetchConfig $addon.manifestPatches $addon.additionalManifests }}
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/charts/cluster-api-operator/templates/core.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/core.yaml
|
||||
@@ -55,1 +55,1 @@
|
||||
- diagnosticsAddress: {{ $core.manager.metrics.diagnosticsAddress }}
|
||||
+ diagnosticsAddress: {{ $core.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
--- a/charts/cluster-api-operator/templates/bootstrap.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/bootstrap.yaml
|
||||
@@ -51,1 +51,1 @@
|
||||
- diagnosticsAddress: {{ $bootstrap.manager.metrics.diagnosticsAddress }}
|
||||
+ diagnosticsAddress: {{ $bootstrap.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
--- a/charts/cluster-api-operator/templates/control-plane.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/control-plane.yaml
|
||||
@@ -55,1 +55,1 @@
|
||||
- diagnosticsAddress: {{ $controlPlane.manager.metrics.diagnosticsAddress }}
|
||||
+ diagnosticsAddress: {{ $controlPlane.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
--- a/charts/cluster-api-operator/templates/infra.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/infra.yaml
|
||||
@@ -55,1 +55,1 @@
|
||||
- diagnosticsAddress: {{ $infra.manager.metrics.diagnosticsAddress }}
|
||||
+ diagnosticsAddress: {{ $infra.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
--- a/charts/cluster-api-operator/templates/ipam.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/ipam.yaml
|
||||
@@ -55,1 +55,1 @@
|
||||
- diagnosticsAddress: {{ $ipam.manager.metrics.diagnosticsAddress }}
|
||||
+ diagnosticsAddress: {{ $ipam.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
--- a/charts/cluster-api-operator/templates/addon.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/addon.yaml
|
||||
@@ -45,1 +45,1 @@
|
||||
- diagnosticsAddress: {{ $addon.manager.metrics.diagnosticsAddress }}
|
||||
+ diagnosticsAddress: {{ $addon.manager.metrics.diagnosticsAddress | toYaml }}
|
||||
--- a/charts/cluster-api-operator/templates/_helpers.tpl
|
||||
+++ b/charts/cluster-api-operator/templates/_helpers.tpl
|
||||
@@ -30,1 +30,1 @@
|
||||
- name: {{ default (($.Values).configSecret).name (($arg).configSecret).name }}
|
||||
+ name: {{ default (($.Values).configSecret).name (($arg).configSecret).name | toYaml }}
|
||||
@@ -32,1 +32,1 @@
|
||||
- namespace: {{ default (($.Values).configSecret).namespace (($arg).configSecret).namespace }}
|
||||
+ namespace: {{ default (($.Values).configSecret).namespace (($arg).configSecret).namespace | toYaml }}
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/charts/cluster-api-operator/templates/deployment.yaml
|
||||
+++ b/charts/cluster-api-operator/templates/deployment.yaml
|
||||
@@ -86,6 +86,9 @@
|
||||
- --leader-elect-retry-period={{ .retryPeriod }}
|
||||
@@ -95,6 +95,9 @@
|
||||
- --contention-profiling={{ $.Values.contentionProfiling }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
+ {{- with .Values.syncPeriod }}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{{- define "cozystack.capi-operator.legacyFeatureGates" -}}
|
||||
{{- $manager := deepCopy (.provider.manager | default dict) -}}
|
||||
{{- $legacy := dig "featureGates" .key (dict) (.root.Values.manager | default dict) -}}
|
||||
{{- if and (not (hasKey $manager "featureGates")) $legacy -}}
|
||||
{{- $_ := set $manager "featureGates" (deepCopy $legacy) -}}
|
||||
{{- $_ := set .provider "manager" $manager -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in new issue
Block a user