From 26a1bd52c70dc849ef69ba78f8a60dcde0092f5d Mon Sep 17 00:00:00 2001 From: Spencer Gilbert Date: Thu, 30 Sep 2021 14:52:36 -0400 Subject: [PATCH] feat(vector): Create checksum annotations for existingConfig and extraConfigs (#69) Signed-off-by: Spencer Gilbert --- charts/vector/templates/daemonset.yaml | 13 +++++++++++++ charts/vector/templates/deployment.yaml | 13 +++++++++++++ charts/vector/templates/statefulset.yaml | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/charts/vector/templates/daemonset.yaml b/charts/vector/templates/daemonset.yaml index 1b512f9..d0434fd 100644 --- a/charts/vector/templates/daemonset.yaml +++ b/charts/vector/templates/daemonset.yaml @@ -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 }} diff --git a/charts/vector/templates/deployment.yaml b/charts/vector/templates/deployment.yaml index bb425f9..c9527cc 100644 --- a/charts/vector/templates/deployment.yaml +++ b/charts/vector/templates/deployment.yaml @@ -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 }} diff --git a/charts/vector/templates/statefulset.yaml b/charts/vector/templates/statefulset.yaml index e91401c..0cd712b 100644 --- a/charts/vector/templates/statefulset.yaml +++ b/charts/vector/templates/statefulset.yaml @@ -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 }}