diff --git a/hack/charts/cluster-api-operator/templates/addon.yaml b/hack/charts/cluster-api-operator/templates/addon.yaml index 2fe0d70fb..fa9240ba1 100644 --- a/hack/charts/cluster-api-operator/templates/addon.yaml +++ b/hack/charts/cluster-api-operator/templates/addon.yaml @@ -28,9 +28,21 @@ 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 }} + 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..bd6c8e6f5 100644 --- a/hack/charts/cluster-api-operator/templates/bootstrap.yaml +++ b/hack/charts/cluster-api-operator/templates/bootstrap.yaml @@ -28,9 +28,21 @@ 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 }} + 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..9366f89d2 100644 --- a/hack/charts/cluster-api-operator/templates/control-plane.yaml +++ b/hack/charts/cluster-api-operator/templates/control-plane.yaml @@ -28,24 +28,29 @@ 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 }} 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..c97b969f5 100644 --- a/hack/charts/cluster-api-operator/templates/core.yaml +++ b/hack/charts/cluster-api-operator/templates/core.yaml @@ -28,20 +28,29 @@ 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 }} 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..023aa87bc 100644 --- a/hack/charts/cluster-api-operator/templates/infra-conditions.yaml +++ b/hack/charts/cluster-api-operator/templates/infra-conditions.yaml @@ -61,15 +61,6 @@ metadata: "argocd.argoproj.io/sync-wave": "2" {{- with .Values.configSecret }} spec: -{{- if $.Values.manager }} -{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.kubeadm }} - manager: - featureGates: - {{- range $key, $value := $.Values.manager.featureGates.kubeadm }} - {{ $key }}: {{ $value }} - {{- end }} -{{- end }} -{{- end }} configSecret: name: {{ .name }} {{- if .namespace }} diff --git a/hack/charts/cluster-api-operator/templates/infra.yaml b/hack/charts/cluster-api-operator/templates/infra.yaml index 908423cde..0cf6d4330 100644 --- a/hack/charts/cluster-api-operator/templates/infra.yaml +++ b/hack/charts/cluster-api-operator/templates/infra.yaml @@ -28,24 +28,29 @@ 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 }} 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..eabe7c146 100644 --- a/hack/charts/cluster-api-operator/templates/ipam.yaml +++ b/hack/charts/cluster-api-operator/templates/ipam.yaml @@ -28,24 +28,29 @@ 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 }} 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 diff --git a/test/e2e/helm_test.go b/test/e2e/helm_test.go index a6178f654..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", - "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()) diff --git a/test/e2e/resources/kubeadm-manager-defined.yaml b/test/e2e/resources/kubeadm-manager-defined.yaml index 9719171e7..c8b285b39 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 @@ -130,5 +128,4 @@ metadata: annotations: "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 + "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 af8db65c4..80fc75ccf 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 @@ -130,5 +128,4 @@ metadata: annotations: "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 + "argocd.argoproj.io/sync-wave": "2" \ No newline at end of file