Skip to content

Commit

Permalink
feat(vector): Create checksum annotations for existingConfig and extr…
Browse files Browse the repository at this point in the history
…aConfigs (#69)

Signed-off-by: Spencer Gilbert <[email protected]>
  • Loading branch information
spencergilbert authored Sep 30, 2021
1 parent 5901de8 commit 26a1bd5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions charts/vector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ spec:
metadata:
annotations:
{{- if .Values.rollWorkload }}
{{- if .Values.existingConfig }}
{{- range $file, $contents := (lookup "v1" "ConfigMap" (print .Release.Namespace) (print .Values.existingConfig)).data }}
checksum/{{ $file }}: {{ $contents | sha256sum }}
{{- end }}
{{- else }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.extraConfigs }}
{{- range .Values.extraConfigs }}
{{- range $file, $contents := (lookup "v1" "ConfigMap" (print $.Release.Namespace) (print .)).data }}
checksum/extra.{{ $file }}: {{ $contents | sha256sum }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand Down
13 changes: 13 additions & 0 deletions charts/vector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ spec:
metadata:
annotations:
{{- if .Values.rollWorkload }}
{{- if .Values.existingConfig }}
{{- range $file, $contents := (lookup "v1" "ConfigMap" (print .Release.Namespace) (print .Values.existingConfig)).data }}
checksum/{{ $file }}: {{ $contents | sha256sum }}
{{- end }}
{{- else }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.extraConfigs }}
{{- range .Values.extraConfigs }}
{{- range $file, $contents := (lookup "v1" "ConfigMap" (print $.Release.Namespace) (print .)).data }}
checksum/extra.{{ $file }}: {{ $contents | sha256sum }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand Down
13 changes: 13 additions & 0 deletions charts/vector/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ spec:
metadata:
annotations:
{{- if .Values.rollWorkload }}
{{- if .Values.existingConfig }}
{{- range $file, $contents := (lookup "v1" "ConfigMap" (print .Release.Namespace) (print .Values.existingConfig)).data }}
checksum/{{ $file }}: {{ $contents | sha256sum }}
{{- end }}
{{- else }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.extraConfigs }}
{{- range .Values.extraConfigs }}
{{- range $file, $contents := (lookup "v1" "ConfigMap" (print $.Release.Namespace) (print .)).data }}
checksum/extra.{{ $file }}: {{ $contents | sha256sum }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
Expand Down

0 comments on commit 26a1bd5

Please sign in to comment.