Add configmap hashing approach to horizon to allow rolling updates

when configmaps are updated
This commit is contained in:
Alan Meadows 2016-12-21 09:58:13 -08:00
parent e85f080b3f
commit ca2dd29bbd
2 changed files with 13 additions and 0 deletions

View File

@ -11,3 +11,14 @@
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{ include $wtf $context }}
{{- end -}}
{{- define "hash" -}}
{{- $name := index . 0 -}}
{{- $context := index . 1 -}}
{{- $v:= $context.Template.Name | split "/" -}}
{{- $n := len $v -}}
{{- $last := sub $n 1 | printf "_%d" | index $v -}}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -9,6 +9,8 @@ spec:
labels:
app: horizon
annotations:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{
"name": "init",