Skip to content

Commit

Permalink
Remove restartOnChange and add finer checksum
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Dec 4, 2023
1 parent a7549e6 commit 89a1e0f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
8 changes: 8 additions & 0 deletions charts/velero/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ For examples:
{{- $minorVersion := .Capabilities.KubeVersion.Minor | regexFind "[0-9]+" -}}
{{- printf "%s.%s" .Capabilities.KubeVersion.Major $minorVersion -}}
{{- end -}}


{{/*
Calculate the checksum of the credentials secret.
*/}}
{{- define "chart.config-checksum" -}}
{{- tpl (print .Values.credentials.secretContents .Values.credentials.extraEnvVars ) $ | sha256sum -}}
{{- end -}}
6 changes: 3 additions & 3 deletions charts/velero/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
{{- if or .Values.podAnnotations .Values.metrics.enabled (and .Values.credentials.useSecret (not .Values.credentials.existingSecret) .Values.credentials.restartOnChange) }}
{{- if or .Values.podAnnotations .Values.metrics.enabled (and .Values.credentials.useSecret (not .Values.credentials.existingSecret)) }}
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand All @@ -50,8 +50,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) .Values.credentials.restartOnChange }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) }}
checksum/secret: {{ template "chart.config-checksum" . }}
{{- end }}
{{- end }}
spec:
Expand Down
6 changes: 3 additions & 3 deletions charts/velero/templates/node-agent-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
{{- if or .Values.podAnnotations .Values.metrics.enabled (and .Values.credentials.useSecret (not .Values.credentials.existingSecret) .Values.credentials.restartOnChange) }}
{{- if or .Values.podAnnotations .Values.metrics.enabled (and .Values.credentials.useSecret (not .Values.credentials.existingSecret)) }}
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand All @@ -43,8 +43,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) .Values.credentials.restartOnChange }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if and .Values.credentials.useSecret (not .Values.credentials.existingSecret) }}
checksum/secret: {{ template "chart.config-checksum" . }}
{{- end }}
{{- end }}
spec:
Expand Down
2 changes: 0 additions & 2 deletions charts/velero/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,6 @@ credentials:
# that will be used to load environment variables into velero and node-agent.
# Secret should be in format - https://kubernetes.io/docs/concepts/configuration/secret/#use-case-as-container-environment-variables
extraSecretRef: ""
# If true, the velero controller will be restarted if the secret has been changed.
restartOnChange: false

# Whether to create backupstoragelocation crd, if false => do not create a default backup location
backupsEnabled: true
Expand Down

0 comments on commit 89a1e0f

Please sign in to comment.