Skip to content

Commit 4d30c94

Browse files
committed
feat(chart): add insecureDiagnostics and diagnosticsAddress
1 parent d21153e commit 4d30c94

File tree

11 files changed

+144
-89
lines changed

11 files changed

+144
-89
lines changed

hack/charts/cluster-api-operator/templates/addon.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,21 @@ metadata:
2828
"helm.sh/hook-weight": "2"
2929
{{- end }}
3030
"argocd.argoproj.io/sync-wave": "2"
31-
{{- if or $addonVersion $.Values.secretName $.Values.configSecret.name (($addon).configSecret).name }}
31+
{{- if or $addonVersion $.Values.secretName $.Values.configSecret.name $addon.manager (($addon).configSecret).name }}
3232
spec:
3333
{{- end}}
34+
{{- if $addon.manager }}
35+
manager:
36+
{{- if $addon.manager.metrics }}
37+
metrics:
38+
{{- if $addon.manager.metrics.insecureDiagnostics }}
39+
insecureDiagnostics: {{- $addon.manager.metrics.insecureDiagnostics }}
40+
{{- end }}
41+
{{- if $addon.manager.metrics.diagnosticsAddress }}
42+
diagnosticsAddress: {{- $addon.manager.metrics.diagnosticsAddress }}
43+
{{- end }}
44+
{{- end }}
45+
{{- end }}
3446
{{- if $addonVersion }}
3547
version: {{ $addonVersion }}
3648
{{- end }}

hack/charts/cluster-api-operator/templates/bootstrap.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,21 @@ metadata:
2828
"helm.sh/hook-weight": "2"
2929
{{- end }}
3030
"argocd.argoproj.io/sync-wave": "2"
31-
{{- if or $bootstrapVersion $.Values.configSecret.name (($bootstrap).configSecret).name }}
31+
{{- if or $bootstrapVersion $.Values.configSecret.name $bootstrap.manager (($bootstrap).configSecret).name }}
3232
spec:
3333
{{- end}}
34+
{{- if $bootstrap.manager }}
35+
manager:
36+
{{- if $bootstrap.manager.metrics }}
37+
metrics:
38+
{{- if $bootstrap.manager.metrics.insecureDiagnostics }}
39+
insecureDiagnostics: {{- $bootstrap.manager.metrics.insecureDiagnostics }}
40+
{{- end }}
41+
{{- if $bootstrap.manager.metrics.diagnosticsAddress }}
42+
diagnosticsAddress: {{- $bootstrap.manager.metrics.diagnosticsAddress }}
43+
{{- end }}
44+
{{- end }}
45+
{{- end }}
3446
{{- if $bootstrapVersion }}
3547
version: {{ $bootstrapVersion }}
3648
{{- end }}

hack/charts/cluster-api-operator/templates/control-plane.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@ metadata:
2828
"helm.sh/hook-weight": "2"
2929
{{- end }}
3030
"argocd.argoproj.io/sync-wave": "2"
31-
{{- if or $controlPlaneVersion $.Values.configSecret.name $.Values.manager (($controlPlane).configSecret).name }}
31+
{{- if or $controlPlaneVersion $.Values.configSecret.name $controlPlane.manager (($controlPlane).configSecret).name }}
3232
spec:
3333
{{- end}}
3434
{{- if $controlPlaneVersion }}
3535
version: {{ $controlPlaneVersion }}
3636
{{- end }}
37-
{{- if $.Values.manager }}
38-
{{- if hasKey $.Values.manager.featureGates $controlPlaneName }}
37+
{{- if $controlPlane.manager }}
3938
manager:
40-
{{- range $key, $value := $.Values.manager.featureGates }}
41-
{{- if eq $key $controlPlaneName }}
39+
{{- if $controlPlane.manager.featureGates }}
4240
featureGates:
43-
{{- range $k, $v := $value }}
44-
{{ $k }}: {{ $v }}
41+
{{- range $key, $value := $controlPlane.manager.featureGates }}
42+
{{ $key }}: {{ $value }}
43+
{{- end }}
44+
{{- end }}
45+
{{- if $controlPlane.manager.metrics }}
46+
metrics:
47+
{{- if $controlPlane.manager.metrics.insecureDiagnostics }}
48+
insecureDiagnostics: {{- $controlPlane.manager.metrics.insecureDiagnostics }}
49+
{{- end }}
50+
{{- if $controlPlane.manager.metrics.diagnosticsAddress }}
51+
diagnosticsAddress: {{- $controlPlane.manager.metrics.diagnosticsAddress }}
4552
{{- end }}
4653
{{- end }}
47-
{{- end }}
48-
{{- end }}
4954
{{- end }}
5055
{{- if (default (($controlPlane).configSecret).name (($.Values).configSecret).name) }}
5156
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $controlPlane) | nindent 2 }}

hack/charts/cluster-api-operator/templates/core.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,29 @@ metadata:
2828
"helm.sh/hook-weight": "2"
2929
{{- end }}
3030
"argocd.argoproj.io/sync-wave": "2"
31-
{{- if or $coreVersion $.Values.configSecret.name $.Values.manager (($core).configSecret).name }}
31+
{{- if or $coreVersion $.Values.configSecret.name $core.manager (($core).configSecret).name }}
3232
spec:
3333
{{- end}}
3434
{{- if $coreVersion }}
3535
version: {{ $coreVersion }}
3636
{{- end }}
37-
{{- if $.Values.manager }}
38-
{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.core }}
37+
{{- if $core.manager }}
3938
manager:
39+
{{- if $core.manager.featureGates }}
4040
featureGates:
41-
{{- range $key, $value := $.Values.manager.featureGates.core }}
41+
{{- range $key, $value := $core.manager.featureGates }}
4242
{{ $key }}: {{ $value }}
4343
{{- end }}
44-
{{- end }}
44+
{{- end }}
45+
{{- if $core.manager.metrics }}
46+
metrics:
47+
{{- if $core.manager.metrics.insecureDiagnostics }}
48+
insecureDiagnostics: {{- $core.manager.metrics.insecureDiagnostics }}
49+
{{- end }}
50+
{{- if $core.manager.metrics.diagnosticsAddress }}
51+
diagnosticsAddress: {{- $core.manager.metrics.diagnosticsAddress }}
52+
{{- end }}
53+
{{- end }}
4554
{{- end }}
4655
{{- if (default (($core).configSecret).name (($.Values).configSecret).name) }}
4756
{{- include "capi-operator.configSecret" (dict "ROOT" $ "ARGUMENT" $core) | nindent 2 }}

hack/charts/cluster-api-operator/templates/infra-conditions.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ metadata:
6161
"argocd.argoproj.io/sync-wave": "2"
6262
{{- with .Values.configSecret }}
6363
spec:
64-
{{- if $.Values.manager }}
65-
{{- if and $.Values.manager.featureGates $.Values.manager.featureGates.kubeadm }}
66-
manager:
67-
featureGates:
68-
{{- range $key, $value := $.Values.manager.featureGates.kubeadm }}
69-
{{ $key }}: {{ $value }}
70-
{{- end }}
71-
{{- end }}
72-
{{- end }}
7364
configSecret:
7465
name: {{ .name }}
7566
{{- if .namespace }}

hack/charts/cluster-api-operator/templates/infra.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@ metadata:
2828
"helm.sh/hook-weight": "2"
2929
{{- end }}
3030
"argocd.argoproj.io/sync-wave": "2"
31-
{{- if or $infrastructureVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments (($infra).configSecret).name }}
31+
{{- if or $infrastructureVersion $.Values.configSecret.name $infra.manager $.Values.additionalDeployments (($infra).configSecret).name }}
3232
spec:
3333
{{- end }}
3434
{{- if $infrastructureVersion }}
3535
version: {{ $infrastructureVersion }}
3636
{{- end }}
37-
{{- if $.Values.manager }}
38-
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $infrastructureName) }}
37+
{{- if $infra.manager }}
3938
manager:
40-
{{- range $key, $value := $.Values.manager.featureGates }}
41-
{{- if eq $key $infrastructureName }}
39+
{{- if $infra.manager.featureGates }}
4240
featureGates:
43-
{{- range $k, $v := $value }}
44-
{{ $k }}: {{ $v }}
41+
{{- range $key, $value := $infra.manager.featureGates }}
42+
{{ $key }}: {{ $value }}
43+
{{- end }}
44+
{{- end }}
45+
{{- if $infra.manager.metrics }}
46+
metrics:
47+
{{- if $infra.manager.metrics.insecureDiagnostics }}
48+
insecureDiagnostics: {{- $infra.manager.metrics.insecureDiagnostics }}
49+
{{- end }}
50+
{{- if $infra.manager.metrics.diagnosticsAddress }}
51+
diagnosticsAddress: {{- $infra.manager.metrics.diagnosticsAddress }}
4552
{{- end }}
4653
{{- end }}
47-
{{- end }}
48-
{{- end }}
4954
{{- end }}
5055
{{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $infrastructureName) }}
5156
{{- range $key, $value := $.Values.fetchConfig }}

hack/charts/cluster-api-operator/templates/ipam.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@ metadata:
2828
"helm.sh/hook-weight": "2"
2929
{{- end }}
3030
"argocd.argoproj.io/sync-wave": "2"
31-
{{- if or $ipamVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments (($ipam).configSecret).name }}
31+
{{- if or $ipamVersion $.Values.configSecret.name $ipam.manager $.Values.additionalDeployments (($ipam).configSecret).name }}
3232
spec:
3333
{{- end }}
3434
{{- if $ipamVersion }}
3535
version: {{ $ipamVersion }}
3636
{{- end }}
37-
{{- if $.Values.manager }}
38-
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $ipamName) }}
37+
{{- if $ipam.manager }}
3938
manager:
40-
{{- range $key, $value := $.Values.manager.featureGates }}
41-
{{- if eq $key $ipamName }}
39+
{{- if $ipam.manager.featureGates }}
4240
featureGates:
43-
{{- range $k, $v := $value }}
44-
{{ $k }}: {{ $v }}
41+
{{- range $key, $value := $ipam.manager.featureGates }}
42+
{{ $key }}: {{ $value }}
43+
{{- end }}
44+
{{- end }}
45+
{{- if $ipam.manager.metrics }}
46+
metrics:
47+
{{- if $ipam.manager.metrics.insecureDiagnostics }}
48+
insecureDiagnostics: {{- $ipam.manager.metrics.insecureDiagnostics }}
49+
{{- end }}
50+
{{- if $ipam.manager.metrics.diagnosticsAddress }}
51+
diagnosticsAddress: {{- $ipam.manager.metrics.diagnosticsAddress }}
4552
{{- end }}
4653
{{- end }}
47-
{{- end }}
48-
{{- end }}
4954
{{- end }}
5055
{{- if and (kindIs "map" $.Values.fetchConfig) (hasKey $.Values.fetchConfig $ipamName) }}
5156
{{- range $key, $value := $.Values.fetchConfig }}

hack/charts/cluster-api-operator/values.yaml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,63 @@ core: {}
66
# namespace: "" # Optional
77
# version: "" # Optional
88
# createNamespace: true # Optional
9+
# manager: # Optional
10+
# featureGates:
11+
# ClusterTopology: true
12+
# metrics:
13+
# insecureDiagnostics: true
14+
# diagnosticsAddress: localhost:8080
915
bootstrap: {}
1016
# kubeadm: {} # Name, required
1117
# namespace: "" # Optional
1218
# version: "" # Optional
1319
# createNamespace: true # Optional
20+
# manager: # Optional
21+
# metrics:
22+
# insecureDiagnostics: true
23+
# diagnosticsAddress: localhost:8080
1424
controlPlane: {}
1525
# kubeadm: {} # Name, required
1626
# namespace: "" # Optional
1727
# version: "" # Optional
1828
# createNamespace: true # Optional
29+
# manager: # Optional
30+
# featureGates:
31+
# ClusterTopology: true
32+
# metrics:
33+
# insecureDiagnostics: true
34+
# diagnosticsAddress: localhost:8080
1935
infrastructure: {}
2036
# docker: {} # Name, required
2137
# namespace: "" # Optional
2238
# version: "" # Optional
2339
# createNamespace: true # Optional
40+
# manager: # Optional
41+
# featureGates:
42+
# ClusterTopology: true
43+
# metrics:
44+
# insecureDiagnostics: true
45+
# diagnosticsAddress: localhost:8080
2446
addon: {}
2547
# helm: {} # Name, required
2648
# namespace: "" # Optional
2749
# version: "" # Optional
2850
# createNamespace: true # Optional
51+
# manager: # Optional
52+
# metrics:
53+
# insecureDiagnostics: true
54+
# diagnosticsAddress: localhost:8080
2955
ipam: {}
3056
# in-cluster: {} # Name, required
3157
# namespace: "" # Optional
3258
# version: "" # Optional
3359
# createNamespace: true # Optional
34-
manager.featureGates: {}
35-
# Configuration for enabling feature gates in different providers
36-
# manager:
37-
# featureGates:
38-
# proxmox: # Name of the provider
39-
# ClusterTopology: true
40-
# core:
41-
# ClusterTopology: true
42-
# kubeadm:
60+
# manager: # Optional
61+
# featureGates:
4362
# ClusterTopology: true
63+
# metrics:
64+
# insecureDiagnostics: true
65+
# diagnosticsAddress: localhost:8080
4466
fetchConfig: {}
4567
# ---
4668
# Common configuration secret options

test/e2e/helm_test.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,19 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
354354
})
355355
It("should deploy core and infra with feature gates enabled", func() {
356356
manifests, err := helmChart.Run(map[string]string{
357-
"configSecret.name": "aws-variables",
358-
"configSecret.namespace": "default",
359-
"infrastructure.aws.version": "v2.4.0",
360-
"ipam.in-cluster.enabled": "true",
361-
"addon.helm.enabled": "true",
362-
"image.manager.tag": "v0.9.1",
363-
"core.cluster-api.version": "v1.6.2",
364-
"manager.featureGates.core.ClusterTopology": "true",
365-
"manager.featureGates.core.MachinePool": "true",
366-
"manager.featureGates.aws.ClusterTopology": "true",
367-
"manager.featureGates.aws.MachinePool": "true",
368-
"manager.featureGates.aws.EKSEnableIAM": "true",
369-
"manager.featureGates.aws.EKSAllowAddRoles": "true",
357+
"configSecret.name": "aws-variables",
358+
"configSecret.namespace": "default",
359+
"infrastructure.aws.version": "v2.4.0",
360+
"infrastructure.aws.manager.featureGates.ClusterTopology": "true",
361+
"infrastructure.aws.manager.featureGates.MachinePool": "true",
362+
"infrastructure.aws.manager.featureGates.EKSEnableIAM": "true",
363+
"infrastructure.aws.manager.featureGates.EKSAllowAddRoles": "true",
364+
"ipam.in-cluster.enabled": "true",
365+
"addon.helm.enabled": "true",
366+
"image.manager.tag": "v0.9.1",
367+
"core.cluster-api.version": "v1.6.2",
368+
"core.cluster-api.manager.featureGates.ClusterTopology": "true",
369+
"core.cluster-api.manager.featureGates.MachinePool": "true",
370370
})
371371
Expect(err).ToNot(HaveOccurred())
372372
Expect(manifests).ToNot(BeEmpty())
@@ -391,14 +391,14 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
391391
})
392392
It("should deploy all providers when manager is defined but another infrastructure spec field is defined", func() {
393393
manifests, err := helmChart.Run(map[string]string{
394-
"core.cluster-api.enabled": "true",
395-
"controlPlane.kubeadm.enabled": "true",
396-
"bootstrap.kubeadm.enabled": "true",
397-
"infrastructure.docker.enabled": "true",
398-
"ipam.in-cluster.enabled": "true",
399-
"addon.helm.enabled": "true",
400-
"manager.featureGates.core.ClusterTopology": "true",
401-
"manager.featureGates.core.MachinePool": "true",
394+
"core.cluster-api.enabled": "true",
395+
"core.cluster-api.manager.featureGates.MachinePool": "true",
396+
"core.cluster-api.manager.featureGates.ClusterTopology": "true",
397+
"controlPlane.kubeadm.enabled": "true",
398+
"bootstrap.kubeadm.enabled": "true",
399+
"infrastructure.docker.enabled": "true",
400+
"ipam.in-cluster.enabled": "true",
401+
"addon.helm.enabled": "true",
402402
})
403403
Expect(err).ToNot(HaveOccurred())
404404
Expect(manifests).ToNot(BeEmpty())
@@ -408,14 +408,14 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
408408
})
409409
It("should deploy kubeadm control plane with manager specified", func() {
410410
manifests, err := helmChart.Run(map[string]string{
411-
"core.cluster-api.enabled": "true",
412-
"controlPlane.kubeadm.enabled": "true",
413-
"bootstrap.kubeadm.enabled": "true",
414-
"infrastructure.docker.enabled": "true",
415-
"ipam.in-cluster.enabled": "true",
416-
"addon.helm.enabled": "true",
417-
"manager.featureGates.kubeadm.ClusterTopology": "true",
418-
"manager.featureGates.kubeadm.MachinePool": "true",
411+
"core.cluster-api.enabled": "true",
412+
"controlPlane.kubeadm.enabled": "true",
413+
"controlPlane.kubeadm.manager.featureGates.MachinePool": "true",
414+
"controlPlane.kubeadm.manager.featureGates.ClusterTopology": "true",
415+
"bootstrap.kubeadm.enabled": "true",
416+
"infrastructure.docker.enabled": "true",
417+
"ipam.in-cluster.enabled": "true",
418+
"addon.helm.enabled": "true",
419419
})
420420
Expect(err).ToNot(HaveOccurred())
421421
Expect(manifests).ToNot(BeEmpty())

test/e2e/resources/kubeadm-manager-defined.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ metadata:
107107
"helm.sh/hook": "post-install,post-upgrade"
108108
"helm.sh/hook-weight": "2"
109109
"argocd.argoproj.io/sync-wave": "2"
110-
spec:
111110
---
112111
# Source: cluster-api-operator/templates/ipam.yaml
113112
apiVersion: operator.cluster.x-k8s.io/v1alpha2
@@ -119,7 +118,6 @@ metadata:
119118
"helm.sh/hook": "post-install,post-upgrade"
120119
"helm.sh/hook-weight": "2"
121120
"argocd.argoproj.io/sync-wave": "2"
122-
spec:
123121
---
124122
# Source: cluster-api-operator/templates/infra.yaml
125123
apiVersion: operator.cluster.x-k8s.io/v1alpha2
@@ -130,5 +128,4 @@ metadata:
130128
annotations:
131129
"helm.sh/hook": "post-install,post-upgrade"
132130
"helm.sh/hook-weight": "2"
133-
"argocd.argoproj.io/sync-wave": "2"
134-
spec:
131+
"argocd.argoproj.io/sync-wave": "2"

0 commit comments

Comments
 (0)