Skip to content

Commit ab0db25

Browse files
authored
Merge pull request #525 from jkroepke/tpl-config-reload
[velero] Pass config trough tpl and implement reload trigger
2 parents cbd56ae + 225569d commit ab0db25

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

charts/velero/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ appVersion: 1.12.2
33
kubeVersion: ">=1.16.0-0"
44
description: A Helm chart for velero
55
name: velero
6-
version: 5.1.7
6+
version: 5.2.0
77
home: https://github.com/vmware-tanzu/velero
88
icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png
99
sources:

charts/velero/templates/_helpers.tpl

+8
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,11 @@ For examples:
8686
{{- $minorVersion := .Capabilities.KubeVersion.Minor | regexFind "[0-9]+" -}}
8787
{{- printf "%s.%s" .Capabilities.KubeVersion.Major $minorVersion -}}
8888
{{- end -}}
89+
90+
91+
{{/*
92+
Calculate the checksum of the credentials secret.
93+
*/}}
94+
{{- define "chart.config-checksum" -}}
95+
{{- tpl (print .Values.credentials.secretContents .Values.credentials.extraEnvVars ) $ | sha256sum -}}
96+
{{- end -}}

charts/velero/templates/deployment.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
{{- if .Values.podLabels }}
4141
{{- toYaml .Values.podLabels | nindent 8 }}
4242
{{- end }}
43-
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
43+
{{- if or .Values.podAnnotations .Values.metrics.enabled (and .Values.credentials.useSecret (not .Values.credentials.existingSecret)) }}
4444
annotations:
4545
{{- with .Values.podAnnotations }}
4646
{{- toYaml . | nindent 8 }}
@@ -50,6 +50,9 @@ spec:
5050
{{- toYaml . | nindent 8 }}
5151
{{- end }}
5252
{{- end }}
53+
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) }}
54+
checksum/secret: {{ template "chart.config-checksum" . }}
55+
{{- end }}
5356
{{- end }}
5457
spec:
5558
{{- if .Values.image.imagePullSecrets }}
@@ -218,7 +221,7 @@ spec:
218221
{{- with .Values.configuration.extraEnvVars }}
219222
{{- range $key, $value := . }}
220223
- name: {{ default "none" $key }}
221-
value: {{ default "none" $value | quote }}
224+
value: {{ tpl (default "none" $value) $ | quote }}
222225
{{- end }}
223226
{{- end }}
224227
{{- with .Values.credentials.extraEnvVars }}

charts/velero/templates/node-agent-daemonset.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
{{- if .Values.podLabels }}
3434
{{- toYaml .Values.podLabels | nindent 8 }}
3535
{{- end }}
36-
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
36+
{{- if or .Values.podAnnotations .Values.metrics.enabled (and .Values.credentials.useSecret (not .Values.credentials.existingSecret)) }}
3737
annotations:
3838
{{- with .Values.podAnnotations }}
3939
{{- toYaml . | nindent 8 }}
@@ -43,6 +43,9 @@ spec:
4343
{{- toYaml . | nindent 8 }}
4444
{{- end }}
4545
{{- end }}
46+
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) }}
47+
checksum/secret: {{ template "chart.config-checksum" . }}
48+
{{- end }}
4649
{{- end }}
4750
spec:
4851
{{- if .Values.image.imagePullSecrets }}
@@ -150,7 +153,7 @@ spec:
150153
{{- with .Values.configuration.extraEnvVars }}
151154
{{- range $key, $value := . }}
152155
- name: {{ default "none" $key }}
153-
value: {{ default "none" $value | quote }}
156+
value: {{ tpl (default "none" $value) $ | quote }}
154157
{{- end }}
155158
{{- end }}
156159
{{- with .Values.credentials.extraEnvVars }}
@@ -191,7 +194,7 @@ spec:
191194
{{- with .Values.nodeAgent.affinity }}
192195
affinity:
193196
{{- toYaml . | nindent 8 }}
194-
{{- end }}
197+
{{- end }}
195198
{{- with .Values.nodeAgent.dnsConfig }}
196199
dnsConfig:
197200
{{- toYaml . | nindent 8 }}

charts/velero/templates/secret.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ metadata:
1616
type: Opaque
1717
data:
1818
{{- range $key, $value := .Values.credentials.secretContents }}
19-
{{ $key }}: {{ $value | b64enc | quote }}
19+
{{ $key }}: {{ tpl $value $ | b64enc | quote }}
2020
{{- end }}
2121
{{- range $key, $value := .Values.credentials.extraEnvVars }}
22-
{{ $key }}: {{ $value | b64enc | quote }}
22+
{{ $key }}: {{ tpl $value $ | b64enc | quote }}
2323
{{- end }}
2424
{{- end -}}

charts/velero/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ serviceAccount:
479479
credentials:
480480
# Whether a secret should be used. Set to false if, for examples:
481481
# - using kube2iam or kiam to provide AWS IAM credentials instead of providing the key file. (AWS only)
482-
# - using workload identity instead of providing the key file. (GCP only)
482+
# - using workload identity instead of providing the key file. (Azure/GCP only)
483483
useSecret: true
484484
# Name of the secret to create if `useSecret` is true and `existingSecret` is empty
485485
name:

0 commit comments

Comments
 (0)