Skip to content

Commit

Permalink
Use helper for secret checksum calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Speissi committed Jun 10, 2024
1 parent b5436dd commit 736f709
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions charts/pgcat/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Generate a checksum of the specified template file.
*/}}
{{- define "pgcat.checksum" -}}
{{- $files := .Files -}}
{{- $secretPath := (print $.Template.BasePath "/secret.yaml") -}}
{{- $secret := $files.Get $secretPath -}}
{{- sha256sum $secret -}}
{{- end }}
2 changes: 1 addition & 1 deletion charts/pgcat/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
checksum/secret: {{ include "pgcat.checksum" . }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down

0 comments on commit 736f709

Please sign in to comment.