Skip to content

Commit

Permalink
feat: compute ConfigMap checksum only over .data content
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiburjack committed Nov 28, 2024
1 parent abf681d commit 703b424
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ enableServiceLinks: false
{{- end }}

{{- define "loki.config.checksum" -}}
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- end -}}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
{{- if .Values.useExternalConfig }}
checksum/config: {{ .Values.externalConfigVersion }}
{{- else }}
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- end}}
{{- with .Values.adminApi.annotations }}
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
{{- if .Values.useExternalConfig }}
checksum/config: {{ .Values.externalConfigVersion }}
{{- else }}
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- end}}
{{- with .Values.enterpriseGateway.annotations }}
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/gateway/configmap-gateway.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/gateway/configmap-gateway.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/templates/read/deployment-read.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/templates/read/statefulset-read.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
checksum/config: {{ get (include (print .Template.BasePath "/config.yaml") . | fromYaml) "data" | toYaml | sha256sum }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down

0 comments on commit 703b424

Please sign in to comment.