Skip to content

Commit 6b72fcd

Browse files
authored
Merge pull request #688 from rgeraskin/add-ipam-provider-helm-chart-opt
✨ Add IPAM provider support to Cluster API Operator Helm chart
2 parents c403eb9 + b8d3328 commit 6b72fcd

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed
Lines changed: 73 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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: {}

test/e2e/resources/full-chart-install.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28538,6 +28538,9 @@ spec:
2853828538
# Source: cluster-api-operator/templates/infra.yaml
2853928539
# Infrastructure providers
2854028540
---
28541+
# Source: cluster-api-operator/templates/ipam.yaml
28542+
# IPAM providers
28543+
---
2854128544
# Source: cluster-api-operator/templates/operator-components.yaml
2854228545
apiVersion: cert-manager.io/v1
2854328546
kind: Certificate

0 commit comments

Comments
 (0)