Skip to content

Commit a4fd550

Browse files
committed
feat: add IPAM provider support to Cluster API Operator Helm chart
1 parent 4dab0b7 commit a4fd550

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# IPAM providers
2+
{{- if .Values.ipam }}
3+
{{- $ipams := split ";" .Values.ipam }}
4+
{{- $ipamNamespace := "" }}
5+
{{- $ipamName := "" }}
6+
{{- $ipamVersion := "" }}
7+
{{- range $ipam := $ipams }}
8+
{{- $ipamArgs := split ":" $ipam }}
9+
{{- $ipamArgsLen := len $ipamArgs }}
10+
{{- if eq $ipamArgsLen 3 }}
11+
{{- $ipamNamespace = $ipamArgs._0 }}
12+
{{- $ipamName = $ipamArgs._1 }}
13+
{{- $ipamVersion = $ipamArgs._2 }}
14+
{{- else if eq $ipamArgsLen 2 }}
15+
{{- $ipamNamespace = print $ipamArgs._0 "-ipam-system" }}
16+
{{- $ipamName = $ipamArgs._0 }}
17+
{{- $ipamVersion = $ipamArgs._1 }}
18+
{{- else if eq $ipamArgsLen 1 }}
19+
{{- $ipamNamespace = print $ipamArgs._0 "-ipam-system" }}
20+
{{- $ipamName = $ipamArgs._0 }}
21+
{{- else }}
22+
{{- fail "ipam provider argument should have the following format in-cluster:v1.0.0 or mynamespace:in-cluster:v1.0.0" }}
23+
{{- end }}
24+
---
25+
apiVersion: v1
26+
kind: Namespace
27+
metadata:
28+
annotations:
29+
"helm.sh/hook": "post-install,post-upgrade"
30+
"helm.sh/hook-weight": "1"
31+
"argocd.argoproj.io/sync-wave": "1"
32+
name: {{ $ipamNamespace }}
33+
---
34+
apiVersion: operator.cluster.x-k8s.io/v1alpha2
35+
kind: IPAMProvider
36+
metadata:
37+
name: {{ $ipamName }}
38+
namespace: {{ $ipamNamespace }}
39+
annotations:
40+
"helm.sh/hook": "post-install,post-upgrade"
41+
"helm.sh/hook-weight": "2"
42+
"argocd.argoproj.io/sync-wave": "2"
43+
{{- if or $ipamVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
44+
spec:
45+
{{- end }}
46+
{{- if $ipamVersion }}
47+
version: {{ $ipamVersion }}
48+
{{- end }}
49+
{{- if $.Values.manager }}
50+
manager:
51+
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $ipamName) }}
52+
{{- range $key, $value := $.Values.manager.featureGates }}
53+
{{- if eq $key $ipamName }}
54+
featureGates:
55+
{{- range $k, $v := $value }}
56+
{{ $k }}: {{ $v }}
57+
{{- end }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}
62+
{{- if $.Values.configSecret.name }}
63+
configSecret:
64+
name: {{ $.Values.configSecret.name }}
65+
{{- if $.Values.configSecret.namespace }}
66+
namespace: {{ $.Values.configSecret.namespace }}
67+
{{- end }}
68+
{{- end }}
69+
{{- if $.Values.additionalDeployments }}
70+
additionalDeployments: {{ toYaml $.Values.additionalDeployments | nindent 4 }}
71+
{{- end }}
72+
{{- end }}
73+
{{- end }}

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

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ core: ""
55
bootstrap: ""
66
controlPlane: ""
77
infrastructure: ""
8+
ipam: ""
89
addon: ""
910
manager.featureGates: {}
1011
fetchConfig: {}

0 commit comments

Comments
 (0)