From 8326be588be96c45d00acc9a24f9f0dcf32b5b1c Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Thu, 2 Oct 2025 18:02:12 -0300 Subject: [PATCH 1/8] feat(chart): add insecureDiagnostics and diagnosticsAddress --- .../cluster-api-operator/templates/addon.yaml | 12 ++++++ .../templates/bootstrap.yaml | 12 ++++++ .../templates/control-plane.yaml | 21 ++++++---- .../cluster-api-operator/templates/core.yaml | 17 ++++++-- .../templates/infra-conditions.yaml | 17 ++++++-- .../cluster-api-operator/templates/infra.yaml | 21 ++++++---- .../cluster-api-operator/templates/ipam.yaml | 21 ++++++---- hack/charts/cluster-api-operator/values.yaml | 40 ++++++++++++++----- 8 files changed, 120 insertions(+), 41 deletions(-) diff --git a/hack/charts/cluster-api-operator/templates/addon.yaml b/hack/charts/cluster-api-operator/templates/addon.yaml index 2fe0d70fb..1ec44ad46 100644 --- a/hack/charts/cluster-api-operator/templates/addon.yaml +++ b/hack/charts/cluster-api-operator/templates/addon.yaml @@ -31,6 +31,18 @@ metadata: {{- if or $addonVersion $.Values.secretName $.Values.configSecret.name (($addon).configSecret).name }} spec: {{- 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 }} + {{- end }} + {{- end }} +{{- end }} {{- if $addonVersion }} version: {{ $addonVersion }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/bootstrap.yaml b/hack/charts/cluster-api-operator/templates/bootstrap.yaml index 23e011fe1..7baf843cc 100644 --- a/hack/charts/cluster-api-operator/templates/bootstrap.yaml +++ b/hack/charts/cluster-api-operator/templates/bootstrap.yaml @@ -31,6 +31,18 @@ metadata: {{- if or $bootstrapVersion $.Values.configSecret.name (($bootstrap).configSecret).name }} spec: {{- end}} +{{- if $.bootstrap.manager }} + manager: + {{- 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 }} + {{- end }} + {{- end }} +{{- end }} {{- if $bootstrapVersion }} version: {{ $bootstrapVersion }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/control-plane.yaml b/hack/charts/cluster-api-operator/templates/control-plane.yaml index 4cc9bfcc7..8bdbbe26d 100644 --- a/hack/charts/cluster-api-operator/templates/control-plane.yaml +++ b/hack/charts/cluster-api-operator/templates/control-plane.yaml @@ -34,18 +34,23 @@ spec: {{- if $controlPlaneVersion }} version: {{ $controlPlaneVersion }} {{- end }} -{{- if $.Values.manager }} -{{- if hasKey $.Values.manager.featureGates $controlPlaneName }} +{{- 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 }} {{- end }} {{- end }} -{{- end }} -{{- end }} {{- end }} {{- if (default (($controlPlane).configSecret).name (($.Values).configSecret).name) }} {{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $controlPlane) | nindent 2 }} diff --git a/hack/charts/cluster-api-operator/templates/core.yaml b/hack/charts/cluster-api-operator/templates/core.yaml index 0b859847c..169c1bd1f 100644 --- a/hack/charts/cluster-api-operator/templates/core.yaml +++ b/hack/charts/cluster-api-operator/templates/core.yaml @@ -34,14 +34,23 @@ spec: {{- if $coreVersion }} version: {{ $coreVersion }} {{- end }} -{{- if $.Values.manager }} -{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.core }} +{{- 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 $.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 }} + {{- end }} + {{- end }} {{- end }} {{- if (default (($core).configSecret).name (($.Values).configSecret).name) }} {{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $core) | nindent 2 }} diff --git a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml index d2c2c2170..c90c6a209 100644 --- a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml +++ b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml @@ -61,14 +61,23 @@ metadata: "argocd.argoproj.io/sync-wave": "2" {{- with .Values.configSecret }} spec: -{{- if $.Values.manager }} -{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.kubeadm }} +{{- if $.Values.controlPlane.kubeadm.manager }} manager: + {{- if $.Values.controlPlane.kubeadm.manager.featureGates }} featureGates: - {{- range $key, $value := $.Values.manager.featureGates.kubeadm }} + {{- range $key, $value := $.Values.controlPlane.kubeadm.manager.featureGates }} {{ $key }}: {{ $value }} {{- end }} -{{- end }} + {{- end }} + {{- if $$.Values.controlPlane.kubeadm.manager.metrics }} + metrics: + {{- if $.Values.controlPlane.kubeadm.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $.Values.controlPlane.kubeadm.manager.metrics.insecureDiagnostics }} + {{- end }} + {{- if $.Values.controlPlane.kubeadm.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $.Values.controlPlane.kubeadm.manager.metrics.diagnosticsAddress }} + {{- end }} + {{- end }} {{- end }} configSecret: name: {{ .name }} diff --git a/hack/charts/cluster-api-operator/templates/infra.yaml b/hack/charts/cluster-api-operator/templates/infra.yaml index 908423cde..10108bc58 100644 --- a/hack/charts/cluster-api-operator/templates/infra.yaml +++ b/hack/charts/cluster-api-operator/templates/infra.yaml @@ -34,18 +34,23 @@ spec: {{- if $infrastructureVersion }} version: {{ $infrastructureVersion }} {{- end }} -{{- if $.Values.manager }} -{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $infrastructureName) }} +{{- 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 }} {{- end }} {{- end }} -{{- end }} -{{- end }} {{- end }} {{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName) }} {{- range $key, $value := $.Values.fetchConfig }} diff --git a/hack/charts/cluster-api-operator/templates/ipam.yaml b/hack/charts/cluster-api-operator/templates/ipam.yaml index 83febc8b4..9b5faa2f8 100644 --- a/hack/charts/cluster-api-operator/templates/ipam.yaml +++ b/hack/charts/cluster-api-operator/templates/ipam.yaml @@ -34,18 +34,23 @@ spec: {{- if $ipamVersion }} version: {{ $ipamVersion }} {{- end }} -{{- if $.Values.manager }} -{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $ipamName) }} +{{- 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 }} {{- end }} {{- end }} -{{- end }} -{{- end }} {{- end }} {{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName) }} {{- range $key, $value := $.Values.fetchConfig }} diff --git a/hack/charts/cluster-api-operator/values.yaml b/hack/charts/cluster-api-operator/values.yaml index 745ff9e99..474ce8b1d 100644 --- a/hack/charts/cluster-api-operator/values.yaml +++ b/hack/charts/cluster-api-operator/values.yaml @@ -6,41 +6,63 @@ core: {} # namespace: "" # Optional # version: "" # Optional # createNamespace: true # Optional +# manager: # Optional +# featureGates: +# ClusterTopology: true +# metrics: +# insecureDiagnostics: true +# diagnosticsAddress: localhost:8080 bootstrap: {} # kubeadm: {} # Name, required # namespace: "" # Optional # version: "" # Optional # createNamespace: true # Optional +# manager: # Optional +# metrics: +# insecureDiagnostics: true +# diagnosticsAddress: localhost:8080 controlPlane: {} # kubeadm: {} # Name, required # namespace: "" # Optional # version: "" # Optional # createNamespace: true # Optional +# manager: # Optional +# featureGates: +# ClusterTopology: true +# metrics: +# insecureDiagnostics: true +# diagnosticsAddress: localhost:8080 infrastructure: {} # docker: {} # Name, required # namespace: "" # Optional # version: "" # Optional # createNamespace: true # Optional +# manager: # Optional +# featureGates: +# ClusterTopology: true +# metrics: +# insecureDiagnostics: true +# diagnosticsAddress: localhost:8080 addon: {} # helm: {} # Name, required # namespace: "" # Optional # version: "" # Optional # createNamespace: true # Optional +# manager: # Optional +# metrics: +# insecureDiagnostics: true +# diagnosticsAddress: localhost:8080 ipam: {} # in-cluster: {} # Name, required # namespace: "" # Optional # version: "" # Optional # createNamespace: true # Optional -manager.featureGates: {} -# Configuration for enabling feature gates in different providers -# manager: -# featureGates: -# proxmox: # Name of the provider -# ClusterTopology: true -# core: -# ClusterTopology: true -# kubeadm: +# manager: # Optional +# featureGates: # ClusterTopology: true +# metrics: +# insecureDiagnostics: true +# diagnosticsAddress: localhost:8080 fetchConfig: {} # --- # Common configuration secret options From df75d44f8bdb80aa6534ec5047bedb5f396c2462 Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Fri, 3 Oct 2025 09:50:38 -0300 Subject: [PATCH 2/8] Update hack/charts/cluster-api-operator/templates/infra-conditions.yaml Co-authored-by: Furkat Gofurov --- .../charts/cluster-api-operator/templates/infra-conditions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml index c90c6a209..d0b8a908d 100644 --- a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml +++ b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml @@ -69,7 +69,7 @@ spec: {{ $key }}: {{ $value }} {{- end }} {{- end }} - {{- if $$.Values.controlPlane.kubeadm.manager.metrics }} + {{- if $.Values.controlPlane.kubeadm.manager.metrics }} metrics: {{- if $.Values.controlPlane.kubeadm.manager.metrics.insecureDiagnostics }} insecureDiagnostics: {{- $.Values.controlPlane.kubeadm.manager.metrics.insecureDiagnostics }} From 4fdc217c81662d753113da4aaf0c4dc6147a8be4 Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Fri, 3 Oct 2025 10:32:34 -0300 Subject: [PATCH 3/8] fix: broken helm template --- .../cluster-api-operator/templates/addon.yaml | 12 ++++++------ .../templates/bootstrap.yaml | 12 ++++++------ .../templates/control-plane.yaml | 16 ++++++++-------- .../cluster-api-operator/templates/core.yaml | 16 ++++++++-------- .../cluster-api-operator/templates/infra.yaml | 16 ++++++++-------- .../cluster-api-operator/templates/ipam.yaml | 16 ++++++++-------- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/hack/charts/cluster-api-operator/templates/addon.yaml b/hack/charts/cluster-api-operator/templates/addon.yaml index 1ec44ad46..65b72ea2c 100644 --- a/hack/charts/cluster-api-operator/templates/addon.yaml +++ b/hack/charts/cluster-api-operator/templates/addon.yaml @@ -31,15 +31,15 @@ metadata: {{- if or $addonVersion $.Values.secretName $.Values.configSecret.name (($addon).configSecret).name }} spec: {{- end}} -{{- if $.addon.manager }} +{{- if $addon.manager }} manager: - {{- if $.addon.manager.metrics }} + {{- if $addon.manager.metrics }} metrics: - {{- if $.addon.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.addon.manager.metrics.insecureDiagnostics }} + {{- if $addon.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $addon.manager.metrics.insecureDiagnostics }} {{- end }} - {{- if $.addon.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.addon.manager.metrics.diagnosticsAddress }} + {{- if $addon.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $addon.manager.metrics.diagnosticsAddress }} {{- end }} {{- end }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/bootstrap.yaml b/hack/charts/cluster-api-operator/templates/bootstrap.yaml index 7baf843cc..21ce1b982 100644 --- a/hack/charts/cluster-api-operator/templates/bootstrap.yaml +++ b/hack/charts/cluster-api-operator/templates/bootstrap.yaml @@ -31,15 +31,15 @@ metadata: {{- if or $bootstrapVersion $.Values.configSecret.name (($bootstrap).configSecret).name }} spec: {{- end}} -{{- if $.bootstrap.manager }} +{{- if $bootstrap.manager }} manager: - {{- if $.bootstrap.manager.metrics }} + {{- if $bootstrap.manager.metrics }} metrics: - {{- if $.bootstrap.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.bootstrap.manager.metrics.insecureDiagnostics }} + {{- if $bootstrap.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $bootstrap.manager.metrics.insecureDiagnostics }} {{- end }} - {{- if $.bootstrap.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.bootstrap.manager.metrics.diagnosticsAddress }} + {{- if $bootstrap.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $bootstrap.manager.metrics.diagnosticsAddress }} {{- end }} {{- end }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/control-plane.yaml b/hack/charts/cluster-api-operator/templates/control-plane.yaml index 8bdbbe26d..c1cd213d2 100644 --- a/hack/charts/cluster-api-operator/templates/control-plane.yaml +++ b/hack/charts/cluster-api-operator/templates/control-plane.yaml @@ -34,21 +34,21 @@ spec: {{- if $controlPlaneVersion }} version: {{ $controlPlaneVersion }} {{- end }} -{{- if $.controlPlane.manager }} +{{- if $controlPlane.manager }} manager: - {{- if $.controlPlane.manager.featureGates }} + {{- if $controlPlane.manager.featureGates }} featureGates: - {{- range $key, $value := $.controlPlane.manager.featureGates }} + {{- range $key, $value := $controlPlane.manager.featureGates }} {{ $key }}: {{ $value }} {{- end }} {{- end }} - {{- if $.controlPlane.manager.metrics }} + {{- if $controlPlane.manager.metrics }} metrics: - {{- if $.controlPlane.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.controlPlane.manager.metrics.insecureDiagnostics }} + {{- if $controlPlane.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $controlPlane.manager.metrics.insecureDiagnostics }} {{- end }} - {{- if $.controlPlane.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.controlPlane.manager.metrics.diagnosticsAddress }} + {{- if $controlPlane.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $controlPlane.manager.metrics.diagnosticsAddress }} {{- end }} {{- end }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/core.yaml b/hack/charts/cluster-api-operator/templates/core.yaml index 169c1bd1f..4c70737c5 100644 --- a/hack/charts/cluster-api-operator/templates/core.yaml +++ b/hack/charts/cluster-api-operator/templates/core.yaml @@ -34,21 +34,21 @@ spec: {{- if $coreVersion }} version: {{ $coreVersion }} {{- end }} -{{- if $.core.manager }} +{{- if $core.manager }} manager: - {{- if $.core.manager.featureGates }} + {{- if $core.manager.featureGates }} featureGates: - {{- range $key, $value := $.core.manager.featureGates }} + {{- range $key, $value := $core.manager.featureGates }} {{ $key }}: {{ $value }} {{- end }} {{- end }} - {{- if $.core.manager.metrics }} + {{- if $core.manager.metrics }} metrics: - {{- if $.core.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.core.manager.metrics.insecureDiagnostics }} + {{- if $core.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $core.manager.metrics.insecureDiagnostics }} {{- end }} - {{- if $.core.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.core.manager.metrics.diagnosticsAddress }} + {{- if $core.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $core.manager.metrics.diagnosticsAddress }} {{- end }} {{- end }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/infra.yaml b/hack/charts/cluster-api-operator/templates/infra.yaml index 10108bc58..47dcf8f82 100644 --- a/hack/charts/cluster-api-operator/templates/infra.yaml +++ b/hack/charts/cluster-api-operator/templates/infra.yaml @@ -34,21 +34,21 @@ spec: {{- if $infrastructureVersion }} version: {{ $infrastructureVersion }} {{- end }} -{{- if $.infra.manager }} +{{- if $infra.manager }} manager: - {{- if $.infra.manager.featureGates }} + {{- if $infra.manager.featureGates }} featureGates: - {{- range $key, $value := $.infra.manager.featureGates }} + {{- range $key, $value := $infra.manager.featureGates }} {{ $key }}: {{ $value }} {{- end }} {{- end }} - {{- if $.infra.manager.metrics }} + {{- if $infra.manager.metrics }} metrics: - {{- if $.infra.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.infra.manager.metrics.insecureDiagnostics }} + {{- if $infra.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $infra.manager.metrics.insecureDiagnostics }} {{- end }} - {{- if $.infra.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.infra.manager.metrics.diagnosticsAddress }} + {{- if $infra.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $infra.manager.metrics.diagnosticsAddress }} {{- end }} {{- end }} {{- end }} diff --git a/hack/charts/cluster-api-operator/templates/ipam.yaml b/hack/charts/cluster-api-operator/templates/ipam.yaml index 9b5faa2f8..afcf8e229 100644 --- a/hack/charts/cluster-api-operator/templates/ipam.yaml +++ b/hack/charts/cluster-api-operator/templates/ipam.yaml @@ -34,21 +34,21 @@ spec: {{- if $ipamVersion }} version: {{ $ipamVersion }} {{- end }} -{{- if $.ipam.manager }} +{{- if $ipam.manager }} manager: - {{- if $.ipam.manager.featureGates }} + {{- if $ipam.manager.featureGates }} featureGates: - {{- range $key, $value := $.ipam.manager.featureGates }} + {{- range $key, $value := $ipam.manager.featureGates }} {{ $key }}: {{ $value }} {{- end }} {{- end }} - {{- if $.ipam.manager.metrics }} + {{- if $ipam.manager.metrics }} metrics: - {{- if $.ipam.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.ipam.manager.metrics.insecureDiagnostics }} + {{- if $ipam.manager.metrics.insecureDiagnostics }} + insecureDiagnostics: {{- $ipam.manager.metrics.insecureDiagnostics }} {{- end }} - {{- if $.ipam.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.ipam.manager.metrics.diagnosticsAddress }} + {{- if $ipam.manager.metrics.diagnosticsAddress }} + diagnosticsAddress: {{- $ipam.manager.metrics.diagnosticsAddress }} {{- end }} {{- end }} {{- end }} From 89817bf65f734d76d654a5516bce76c4cc6cca1c Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Fri, 3 Oct 2025 11:44:44 -0300 Subject: [PATCH 4/8] fix: remove manager from infra conditions --- .../templates/infra-conditions.yaml | 18 ------ test/e2e/helm_test.go | 58 +++++++++---------- 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml index d0b8a908d..023aa87bc 100644 --- a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml +++ b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml @@ -61,24 +61,6 @@ metadata: "argocd.argoproj.io/sync-wave": "2" {{- with .Values.configSecret }} spec: -{{- if $.Values.controlPlane.kubeadm.manager }} - manager: - {{- if $.Values.controlPlane.kubeadm.manager.featureGates }} - featureGates: - {{- range $key, $value := $.Values.controlPlane.kubeadm.manager.featureGates }} - {{ $key }}: {{ $value }} - {{- end }} - {{- end }} - {{- if $.Values.controlPlane.kubeadm.manager.metrics }} - metrics: - {{- if $.Values.controlPlane.kubeadm.manager.metrics.insecureDiagnostics }} - insecureDiagnostics: {{- $.Values.controlPlane.kubeadm.manager.metrics.insecureDiagnostics }} - {{- end }} - {{- if $.Values.controlPlane.kubeadm.manager.metrics.diagnosticsAddress }} - diagnosticsAddress: {{- $.Values.controlPlane.kubeadm.manager.metrics.diagnosticsAddress }} - {{- end }} - {{- end }} -{{- end }} configSecret: name: {{ .name }} {{- if .namespace }} diff --git a/test/e2e/helm_test.go b/test/e2e/helm_test.go index a6178f654..6fb720546 100644 --- a/test/e2e/helm_test.go +++ b/test/e2e/helm_test.go @@ -354,19 +354,19 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func }) It("should deploy core and infra with feature gates enabled", func() { manifests, err := helmChart.Run(map[string]string{ - "configSecret.name": "aws-variables", - "configSecret.namespace": "default", - "infrastructure.aws.version": "v2.4.0", - "ipam.in-cluster.enabled": "true", - "addon.helm.enabled": "true", - "image.manager.tag": "v0.9.1", - "core.cluster-api.version": "v1.6.2", - "manager.featureGates.core.ClusterTopology": "true", - "manager.featureGates.core.MachinePool": "true", - "manager.featureGates.aws.ClusterTopology": "true", - "manager.featureGates.aws.MachinePool": "true", - "manager.featureGates.aws.EKSEnableIAM": "true", - "manager.featureGates.aws.EKSAllowAddRoles": "true", + "configSecret.name": "aws-variables", + "configSecret.namespace": "default", + "infrastructure.aws.version": "v2.4.0", + "infrastructure.aws.manager.featureGates.ClusterTopology": "true", + "infrastructure.aws.manager.featureGates.MachinePool": "true", + "infrastructure.aws.manager.featureGates.EKSEnableIAM": "true", + "infrastructure.aws.manager.featureGates.EKSAllowAddRoles": "true", + "ipam.in-cluster.enabled": "true", + "addon.helm.enabled": "true", + "image.manager.tag": "v0.9.1", + "core.cluster-api.version": "v1.6.2", + "core.cluster-api.manager.featureGates.ClusterTopology": "true", + "core.cluster-api.manager.featureGates.MachinePool": "true", }) Expect(err).ToNot(HaveOccurred()) Expect(manifests).ToNot(BeEmpty()) @@ -391,14 +391,14 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func }) It("should deploy all providers when manager is defined but another infrastructure spec field is defined", func() { manifests, err := helmChart.Run(map[string]string{ - "core.cluster-api.enabled": "true", - "controlPlane.kubeadm.enabled": "true", - "bootstrap.kubeadm.enabled": "true", - "infrastructure.docker.enabled": "true", - "ipam.in-cluster.enabled": "true", - "addon.helm.enabled": "true", - "manager.featureGates.core.ClusterTopology": "true", - "manager.featureGates.core.MachinePool": "true", + "core.cluster-api.enabled": "true", + "core.cluster-api.manager.featureGates.MachinePool": "true", + "core.cluster-api.manager.featureGates.ClusterTopology": "true", + "controlPlane.kubeadm.enabled": "true", + "bootstrap.kubeadm.enabled": "true", + "infrastructure.docker.enabled": "true", + "ipam.in-cluster.enabled": "true", + "addon.helm.enabled": "true", }) Expect(err).ToNot(HaveOccurred()) Expect(manifests).ToNot(BeEmpty()) @@ -408,14 +408,14 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func }) It("should deploy kubeadm control plane with manager specified", func() { manifests, err := helmChart.Run(map[string]string{ - "core.cluster-api.enabled": "true", - "controlPlane.kubeadm.enabled": "true", - "bootstrap.kubeadm.enabled": "true", - "infrastructure.docker.enabled": "true", - "ipam.in-cluster.enabled": "true", - "addon.helm.enabled": "true", - "manager.featureGates.kubeadm.ClusterTopology": "true", - "manager.featureGates.kubeadm.MachinePool": "true", + "core.cluster-api.enabled": "true", + "controlPlane.kubeadm.enabled": "true", + "controlPlane.kubeadm.manager.featureGates.MachinePool": "true", + "controlPlane.kubeadm.manager.featureGates.ClusterTopology": "true", + "bootstrap.kubeadm.enabled": "true", + "infrastructure.docker.enabled": "true", + "ipam.in-cluster.enabled": "true", + "addon.helm.enabled": "true", }) Expect(err).ToNot(HaveOccurred()) Expect(manifests).ToNot(BeEmpty()) From 7c38d996044e92bb62fc3e7a2b7ad92b011dd72f Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Fri, 3 Oct 2025 12:17:57 -0300 Subject: [PATCH 5/8] fix: broken chart condition --- hack/charts/cluster-api-operator/templates/addon.yaml | 2 +- hack/charts/cluster-api-operator/templates/bootstrap.yaml | 2 +- hack/charts/cluster-api-operator/templates/control-plane.yaml | 2 +- hack/charts/cluster-api-operator/templates/core.yaml | 2 +- hack/charts/cluster-api-operator/templates/infra.yaml | 2 +- hack/charts/cluster-api-operator/templates/ipam.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hack/charts/cluster-api-operator/templates/addon.yaml b/hack/charts/cluster-api-operator/templates/addon.yaml index 65b72ea2c..fa9240ba1 100644 --- a/hack/charts/cluster-api-operator/templates/addon.yaml +++ b/hack/charts/cluster-api-operator/templates/addon.yaml @@ -28,7 +28,7 @@ metadata: "helm.sh/hook-weight": "2" {{- end }} "argocd.argoproj.io/sync-wave": "2" -{{- if or $addonVersion $.Values.secretName $.Values.configSecret.name (($addon).configSecret).name }} +{{- if or $addonVersion $.Values.secretName $.Values.configSecret.name $addon.manager (($addon).configSecret).name }} spec: {{- end}} {{- if $addon.manager }} diff --git a/hack/charts/cluster-api-operator/templates/bootstrap.yaml b/hack/charts/cluster-api-operator/templates/bootstrap.yaml index 21ce1b982..bd6c8e6f5 100644 --- a/hack/charts/cluster-api-operator/templates/bootstrap.yaml +++ b/hack/charts/cluster-api-operator/templates/bootstrap.yaml @@ -28,7 +28,7 @@ metadata: "helm.sh/hook-weight": "2" {{- end }} "argocd.argoproj.io/sync-wave": "2" -{{- if or $bootstrapVersion $.Values.configSecret.name (($bootstrap).configSecret).name }} +{{- if or $bootstrapVersion $.Values.configSecret.name $bootstrap.manager (($bootstrap).configSecret).name }} spec: {{- end}} {{- if $bootstrap.manager }} diff --git a/hack/charts/cluster-api-operator/templates/control-plane.yaml b/hack/charts/cluster-api-operator/templates/control-plane.yaml index c1cd213d2..9366f89d2 100644 --- a/hack/charts/cluster-api-operator/templates/control-plane.yaml +++ b/hack/charts/cluster-api-operator/templates/control-plane.yaml @@ -28,7 +28,7 @@ metadata: "helm.sh/hook-weight": "2" {{- end }} "argocd.argoproj.io/sync-wave": "2" -{{- if or $controlPlaneVersion $.Values.configSecret.name $.Values.manager (($controlPlane).configSecret).name }} +{{- if or $controlPlaneVersion $.Values.configSecret.name $controlPlane.manager (($controlPlane).configSecret).name }} spec: {{- end}} {{- if $controlPlaneVersion }} diff --git a/hack/charts/cluster-api-operator/templates/core.yaml b/hack/charts/cluster-api-operator/templates/core.yaml index 4c70737c5..c97b969f5 100644 --- a/hack/charts/cluster-api-operator/templates/core.yaml +++ b/hack/charts/cluster-api-operator/templates/core.yaml @@ -28,7 +28,7 @@ metadata: "helm.sh/hook-weight": "2" {{- end }} "argocd.argoproj.io/sync-wave": "2" -{{- if or $coreVersion $.Values.configSecret.name $.Values.manager (($core).configSecret).name }} +{{- if or $coreVersion $.Values.configSecret.name $core.manager (($core).configSecret).name }} spec: {{- end}} {{- if $coreVersion }} diff --git a/hack/charts/cluster-api-operator/templates/infra.yaml b/hack/charts/cluster-api-operator/templates/infra.yaml index 47dcf8f82..0cf6d4330 100644 --- a/hack/charts/cluster-api-operator/templates/infra.yaml +++ b/hack/charts/cluster-api-operator/templates/infra.yaml @@ -28,7 +28,7 @@ metadata: "helm.sh/hook-weight": "2" {{- end }} "argocd.argoproj.io/sync-wave": "2" -{{- if or $infrastructureVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments (($infra).configSecret).name }} +{{- if or $infrastructureVersion $.Values.configSecret.name $infra.manager $.Values.additionalDeployments (($infra).configSecret).name }} spec: {{- end }} {{- if $infrastructureVersion }} diff --git a/hack/charts/cluster-api-operator/templates/ipam.yaml b/hack/charts/cluster-api-operator/templates/ipam.yaml index afcf8e229..eabe7c146 100644 --- a/hack/charts/cluster-api-operator/templates/ipam.yaml +++ b/hack/charts/cluster-api-operator/templates/ipam.yaml @@ -28,7 +28,7 @@ metadata: "helm.sh/hook-weight": "2" {{- end }} "argocd.argoproj.io/sync-wave": "2" -{{- if or $ipamVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments (($ipam).configSecret).name }} +{{- if or $ipamVersion $.Values.configSecret.name $ipam.manager $.Values.additionalDeployments (($ipam).configSecret).name }} spec: {{- end }} {{- if $ipamVersion }} From b891acc010398f991c8e66554c7ec67f64a49932 Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Mon, 6 Oct 2025 15:49:26 -0300 Subject: [PATCH 6/8] test: adjust test files --- test/e2e/resources/kubeadm-manager-defined.yaml | 3 --- .../resources/manager-defined-missing-other-infra-spec.yaml | 3 --- 2 files changed, 6 deletions(-) diff --git a/test/e2e/resources/kubeadm-manager-defined.yaml b/test/e2e/resources/kubeadm-manager-defined.yaml index 9719171e7..9ac4d859e 100644 --- a/test/e2e/resources/kubeadm-manager-defined.yaml +++ b/test/e2e/resources/kubeadm-manager-defined.yaml @@ -107,7 +107,6 @@ metadata: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" "argocd.argoproj.io/sync-wave": "2" -spec: --- # Source: cluster-api-operator/templates/ipam.yaml apiVersion: operator.cluster.x-k8s.io/v1alpha2 @@ -119,7 +118,6 @@ metadata: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" "argocd.argoproj.io/sync-wave": "2" -spec: --- # Source: cluster-api-operator/templates/infra.yaml apiVersion: operator.cluster.x-k8s.io/v1alpha2 @@ -131,4 +129,3 @@ metadata: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" "argocd.argoproj.io/sync-wave": "2" -spec: \ No newline at end of file diff --git a/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml b/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml index af8db65c4..26370c6af 100644 --- a/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml +++ b/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml @@ -91,7 +91,6 @@ metadata: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" "argocd.argoproj.io/sync-wave": "2" -spec: --- # Source: cluster-api-operator/templates/core.yaml apiVersion: operator.cluster.x-k8s.io/v1alpha2 @@ -119,7 +118,6 @@ metadata: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" "argocd.argoproj.io/sync-wave": "2" -spec: --- # Source: cluster-api-operator/templates/infra.yaml apiVersion: operator.cluster.x-k8s.io/v1alpha2 @@ -131,4 +129,3 @@ metadata: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" "argocd.argoproj.io/sync-wave": "2" -spec: \ No newline at end of file From 3a7d34f86344db2ce2306236cb490873a7194c0e Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Tue, 7 Oct 2025 12:08:22 -0300 Subject: [PATCH 7/8] test: fix tests --- test/e2e/resources/kubeadm-manager-defined.yaml | 2 +- .../e2e/resources/manager-defined-missing-other-infra-spec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/resources/kubeadm-manager-defined.yaml b/test/e2e/resources/kubeadm-manager-defined.yaml index 9ac4d859e..c8b285b39 100644 --- a/test/e2e/resources/kubeadm-manager-defined.yaml +++ b/test/e2e/resources/kubeadm-manager-defined.yaml @@ -128,4 +128,4 @@ metadata: annotations: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" - "argocd.argoproj.io/sync-wave": "2" + "argocd.argoproj.io/sync-wave": "2" \ No newline at end of file diff --git a/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml b/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml index 26370c6af..80fc75ccf 100644 --- a/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml +++ b/test/e2e/resources/manager-defined-missing-other-infra-spec.yaml @@ -128,4 +128,4 @@ metadata: annotations: "helm.sh/hook": "post-install,post-upgrade" "helm.sh/hook-weight": "2" - "argocd.argoproj.io/sync-wave": "2" + "argocd.argoproj.io/sync-wave": "2" \ No newline at end of file From d57062f351d5760d8ad5a6f4095360702c0e68c2 Mon Sep 17 00:00:00 2001 From: Lucas de Farias Teixeira Date: Wed, 8 Oct 2025 10:47:56 -0300 Subject: [PATCH 8/8] style: fix lint --- test/e2e/helm_test.go | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/e2e/helm_test.go b/test/e2e/helm_test.go index 6fb720546..1695a5641 100644 --- a/test/e2e/helm_test.go +++ b/test/e2e/helm_test.go @@ -354,19 +354,19 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func }) It("should deploy core and infra with feature gates enabled", func() { manifests, err := helmChart.Run(map[string]string{ - "configSecret.name": "aws-variables", - "configSecret.namespace": "default", - "infrastructure.aws.version": "v2.4.0", - "infrastructure.aws.manager.featureGates.ClusterTopology": "true", - "infrastructure.aws.manager.featureGates.MachinePool": "true", - "infrastructure.aws.manager.featureGates.EKSEnableIAM": "true", + "configSecret.name": "aws-variables", + "configSecret.namespace": "default", + "infrastructure.aws.version": "v2.4.0", + "infrastructure.aws.manager.featureGates.ClusterTopology": "true", + "infrastructure.aws.manager.featureGates.MachinePool": "true", + "infrastructure.aws.manager.featureGates.EKSEnableIAM": "true", "infrastructure.aws.manager.featureGates.EKSAllowAddRoles": "true", - "ipam.in-cluster.enabled": "true", - "addon.helm.enabled": "true", - "image.manager.tag": "v0.9.1", - "core.cluster-api.version": "v1.6.2", - "core.cluster-api.manager.featureGates.ClusterTopology": "true", - "core.cluster-api.manager.featureGates.MachinePool": "true", + "ipam.in-cluster.enabled": "true", + "addon.helm.enabled": "true", + "image.manager.tag": "v0.9.1", + "core.cluster-api.version": "v1.6.2", + "core.cluster-api.manager.featureGates.ClusterTopology": "true", + "core.cluster-api.manager.featureGates.MachinePool": "true", }) Expect(err).ToNot(HaveOccurred()) Expect(manifests).ToNot(BeEmpty()) @@ -391,14 +391,14 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func }) It("should deploy all providers when manager is defined but another infrastructure spec field is defined", func() { manifests, err := helmChart.Run(map[string]string{ - "core.cluster-api.enabled": "true", + "core.cluster-api.enabled": "true", "core.cluster-api.manager.featureGates.MachinePool": "true", "core.cluster-api.manager.featureGates.ClusterTopology": "true", - "controlPlane.kubeadm.enabled": "true", - "bootstrap.kubeadm.enabled": "true", - "infrastructure.docker.enabled": "true", - "ipam.in-cluster.enabled": "true", - "addon.helm.enabled": "true", + "controlPlane.kubeadm.enabled": "true", + "bootstrap.kubeadm.enabled": "true", + "infrastructure.docker.enabled": "true", + "ipam.in-cluster.enabled": "true", + "addon.helm.enabled": "true", }) Expect(err).ToNot(HaveOccurred()) Expect(manifests).ToNot(BeEmpty()) @@ -408,14 +408,14 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func }) It("should deploy kubeadm control plane with manager specified", func() { manifests, err := helmChart.Run(map[string]string{ - "core.cluster-api.enabled": "true", - "controlPlane.kubeadm.enabled": "true", + "core.cluster-api.enabled": "true", + "controlPlane.kubeadm.enabled": "true", "controlPlane.kubeadm.manager.featureGates.MachinePool": "true", "controlPlane.kubeadm.manager.featureGates.ClusterTopology": "true", - "bootstrap.kubeadm.enabled": "true", - "infrastructure.docker.enabled": "true", - "ipam.in-cluster.enabled": "true", - "addon.helm.enabled": "true", + "bootstrap.kubeadm.enabled": "true", + "infrastructure.docker.enabled": "true", + "ipam.in-cluster.enabled": "true", + "addon.helm.enabled": "true", }) Expect(err).ToNot(HaveOccurred()) Expect(manifests).ToNot(BeEmpty())