Skip to content

Commit 46d9112

Browse files
authored
Merge pull request #751 from afarbos/af/argocdsynchook
🐛 Improve deployment with Argocd by allowing to remove helm hooks
2 parents e2a065e + 5ea7523 commit 46d9112

26 files changed

+103
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ apiVersion: v1
2626
kind: Namespace
2727
metadata:
2828
annotations:
29+
{{- if $.Values.enableHelmHook }}
2930
"helm.sh/hook": "post-install,post-upgrade"
3031
"helm.sh/hook-weight": "1"
32+
{{- end }}
3133
"argocd.argoproj.io/sync-wave": "1"
3234
name: {{ $addonNamespace }}
3335
---
@@ -37,8 +39,10 @@ metadata:
3739
name: {{ $addonName }}
3840
namespace: {{ $addonNamespace }}
3941
annotations:
42+
{{- if $.Values.enableHelmHook }}
4043
"helm.sh/hook": "post-install,post-upgrade"
4144
"helm.sh/hook-weight": "2"
45+
{{- end }}
4246
"argocd.argoproj.io/sync-wave": "2"
4347
{{- if or $addonVersion $.Values.secretName }}
4448
spec:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ apiVersion: v1
2626
kind: Namespace
2727
metadata:
2828
annotations:
29+
{{- if $.Values.enableHelmHook }}
2930
"helm.sh/hook": "post-install,post-upgrade"
3031
"helm.sh/hook-weight": "1"
32+
{{- end }}
33+
"argocd.argoproj.io/sync-wave": "1"
3134
name: {{ $bootstrapNamespace }}
3235
---
3336
apiVersion: operator.cluster.x-k8s.io/v1alpha2
@@ -36,8 +39,11 @@ metadata:
3639
name: {{ $bootstrapName }}
3740
namespace: {{ $bootstrapNamespace }}
3841
annotations:
42+
{{- if $.Values.enableHelmHook }}
3943
"helm.sh/hook": "post-install,post-upgrade"
4044
"helm.sh/hook-weight": "2"
45+
{{- end }}
46+
"argocd.argoproj.io/sync-wave": "2"
4147
{{- if or $bootstrapVersion $.Values.configSecret.name }}
4248
spec:
4349
{{- end}}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ apiVersion: v1
2626
kind: Namespace
2727
metadata:
2828
annotations:
29+
{{- if $.Values.enableHelmHook }}
2930
"helm.sh/hook": "post-install,post-upgrade"
3031
"helm.sh/hook-weight": "1"
32+
{{- end }}
33+
"argocd.argoproj.io/sync-wave": "1"
3134
name: {{ $controlPlaneNamespace }}
3235
---
3336
apiVersion: operator.cluster.x-k8s.io/v1alpha2
@@ -36,8 +39,11 @@ metadata:
3639
name: {{ $controlPlaneName }}
3740
namespace: {{ $controlPlaneNamespace }}
3841
annotations:
42+
{{- if $.Values.enableHelmHook }}
3943
"helm.sh/hook": "post-install,post-upgrade"
4044
"helm.sh/hook-weight": "2"
45+
{{- end }}
46+
"argocd.argoproj.io/sync-wave": "2"
4147
{{- if or $controlPlaneVersion $.Values.configSecret.name $.Values.manager }}
4248
spec:
4349
{{- end}}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ apiVersion: v1
66
kind: Namespace
77
metadata:
88
annotations:
9+
{{- if $.Values.enableHelmHook }}
910
"helm.sh/hook": "post-install,post-upgrade"
1011
"helm.sh/hook-weight": "1"
12+
{{- end }}
13+
"argocd.argoproj.io/sync-wave": "1"
1114
name: capi-system
1215
---
1316
apiVersion: operator.cluster.x-k8s.io/v1alpha2
@@ -16,8 +19,11 @@ metadata:
1619
name: cluster-api
1720
namespace: capi-system
1821
annotations:
22+
{{- if $.Values.enableHelmHook }}
1923
"helm.sh/hook": "post-install,post-upgrade"
2024
"helm.sh/hook-weight": "2"
25+
{{- end }}
26+
"argocd.argoproj.io/sync-wave": "2"
2127
{{- with .Values.configSecret }}
2228
spec:
2329
configSecret:
@@ -28,4 +34,3 @@ spec:
2834
{{- end }}
2935
{{- end }}
3036
{{- end }}
31-

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ apiVersion: v1
2525
kind: Namespace
2626
metadata:
2727
annotations:
28+
{{- if $.Values.enableHelmHook }}
2829
"helm.sh/hook": "post-install,post-upgrade"
2930
"helm.sh/hook-weight": "1"
31+
{{- end }}
32+
"argocd.argoproj.io/sync-wave": "1"
3033
name: {{ $coreNamespace }}
3134
---
3235
apiVersion: operator.cluster.x-k8s.io/v1alpha2
@@ -35,8 +38,10 @@ metadata:
3538
name: {{ $coreName }}
3639
namespace: {{ $coreNamespace }}
3740
annotations:
41+
{{- if $.Values.enableHelmHook }}
3842
"helm.sh/hook": "post-install,post-upgrade"
3943
"helm.sh/hook-weight": "2"
44+
{{- end }}
4045
"argocd.argoproj.io/sync-wave": "2"
4146
{{- if or $coreVersion $.Values.configSecret.name $.Values.manager }}
4247
spec:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ apiVersion: v1
77
kind: Namespace
88
metadata:
99
annotations:
10+
{{- if $.Values.enableHelmHook }}
1011
"helm.sh/hook": "post-install,post-upgrade"
1112
"helm.sh/hook-weight": "1"
13+
{{- end }}
1214
"argocd.argoproj.io/sync-wave": "1"
1315
name: capi-kubeadm-bootstrap-system
1416
---
@@ -18,8 +20,10 @@ metadata:
1820
name: kubeadm
1921
namespace: capi-kubeadm-bootstrap-system
2022
annotations:
23+
{{- if $.Values.enableHelmHook }}
2124
"helm.sh/hook": "post-install,post-upgrade"
2225
"helm.sh/hook-weight": "2"
26+
{{- end }}
2327
"argocd.argoproj.io/sync-wave": "2"
2428
{{- with .Values.configSecret }}
2529
spec:
@@ -37,8 +41,10 @@ apiVersion: v1
3741
kind: Namespace
3842
metadata:
3943
annotations:
44+
{{- if $.Values.enableHelmHook }}
4045
"helm.sh/hook": "post-install,post-upgrade"
4146
"helm.sh/hook-weight": "1"
47+
{{- end }}
4248
"argocd.argoproj.io/sync-wave": "1"
4349
name: capi-kubeadm-control-plane-system
4450
---
@@ -48,8 +54,10 @@ metadata:
4854
name: kubeadm
4955
namespace: capi-kubeadm-control-plane-system
5056
annotations:
57+
{{- if $.Values.enableHelmHook }}
5158
"helm.sh/hook": "post-install,post-upgrade"
5259
"helm.sh/hook-weight": "2"
60+
{{- end }}
5361
"argocd.argoproj.io/sync-wave": "2"
5462
{{- with .Values.configSecret }}
5563
spec:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ apiVersion: v1
2626
kind: Namespace
2727
metadata:
2828
annotations:
29+
{{- if $.Values.enableHelmHook }}
2930
"helm.sh/hook": "post-install,post-upgrade"
3031
"helm.sh/hook-weight": "1"
32+
{{- end }}
3133
"argocd.argoproj.io/sync-wave": "1"
3234
name: {{ $infrastructureNamespace }}
3335
---
@@ -37,8 +39,10 @@ metadata:
3739
name: {{ $infrastructureName }}
3840
namespace: {{ $infrastructureNamespace }}
3941
annotations:
42+
{{- if $.Values.enableHelmHook }}
4043
"helm.sh/hook": "post-install,post-upgrade"
4144
"helm.sh/hook-weight": "2"
45+
{{- end }}
4246
"argocd.argoproj.io/sync-wave": "2"
4347
{{- if or $infrastructureVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
4448
spec:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ apiVersion: v1
2626
kind: Namespace
2727
metadata:
2828
annotations:
29+
{{- if $.Values.enableHelmHook }}
2930
"helm.sh/hook": "post-install,post-upgrade"
3031
"helm.sh/hook-weight": "1"
32+
{{- end }}
3133
"argocd.argoproj.io/sync-wave": "1"
3234
name: {{ $ipamNamespace }}
3335
---
@@ -37,8 +39,10 @@ metadata:
3739
name: {{ $ipamName }}
3840
namespace: {{ $ipamNamespace }}
3941
annotations:
42+
{{- if $.Values.enableHelmHook }}
4043
"helm.sh/hook": "post-install,post-upgrade"
4144
"helm.sh/hook-weight": "2"
45+
{{- end }}
4246
"argocd.argoproj.io/sync-wave": "2"
4347
{{- if or $ipamVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
4448
spec:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ volumeMounts:
6969
- mountPath: /tmp/k8s-webhook-server/serving-certs
7070
name: cert
7171
readOnly: true
72+
enableHelmHook: true

test/e2e/resources/all-providers-custom-ns-versions.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ metadata:
1616
annotations:
1717
"helm.sh/hook": "post-install,post-upgrade"
1818
"helm.sh/hook-weight": "1"
19+
"argocd.argoproj.io/sync-wave": "1"
1920
name: kubeadm-bootstrap-custom-ns
2021
---
2122
# Source: cluster-api-operator/templates/control-plane.yaml
@@ -25,6 +26,7 @@ metadata:
2526
annotations:
2627
"helm.sh/hook": "post-install,post-upgrade"
2728
"helm.sh/hook-weight": "1"
29+
"argocd.argoproj.io/sync-wave": "1"
2830
name: kubeadm-control-plane-custom-ns
2931
---
3032
# Source: cluster-api-operator/templates/core.yaml
@@ -34,6 +36,7 @@ metadata:
3436
annotations:
3537
"helm.sh/hook": "post-install,post-upgrade"
3638
"helm.sh/hook-weight": "1"
39+
"argocd.argoproj.io/sync-wave": "1"
3740
name: capi-custom-ns
3841
---
3942
# Source: cluster-api-operator/templates/infra.yaml
@@ -78,6 +81,7 @@ metadata:
7881
annotations:
7982
"helm.sh/hook": "post-install,post-upgrade"
8083
"helm.sh/hook-weight": "2"
84+
"argocd.argoproj.io/sync-wave": "2"
8185
spec:
8286
version: v1.7.7
8387
configSecret:
@@ -93,6 +97,7 @@ metadata:
9397
annotations:
9498
"helm.sh/hook": "post-install,post-upgrade"
9599
"helm.sh/hook-weight": "2"
100+
"argocd.argoproj.io/sync-wave": "2"
96101
spec:
97102
version: v1.7.7
98103
configSecret:

0 commit comments

Comments
 (0)