Skip to content

Commit 736f709

Browse files
committed
Use helper for secret checksum calculation
1 parent b5436dd commit 736f709

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

charts/pgcat/templates/_helpers.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,13 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Generate a checksum of the specified template file.
66+
*/}}
67+
{{- define "pgcat.checksum" -}}
68+
{{- $files := .Files -}}
69+
{{- $secretPath := (print $.Template.BasePath "/secret.yaml") -}}
70+
{{- $secret := $files.Get $secretPath -}}
71+
{{- sha256sum $secret -}}
72+
{{- end }}

charts/pgcat/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
template:
1313
metadata:
1414
annotations:
15-
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
15+
checksum/secret: {{ include "pgcat.checksum" . }}
1616
{{- with .Values.podAnnotations }}
1717
{{- toYaml . | nindent 8 }}
1818
{{- end }}

0 commit comments

Comments
 (0)