diff --git a/charts/zot/templates/deployment.yaml b/charts/zot/templates/deployment.yaml index 7db025a..8918bc0 100644 --- a/charts/zot/templates/deployment.yaml +++ b/charts/zot/templates/deployment.yaml @@ -15,15 +15,16 @@ spec: {{- include "zot.selectorLabels" . | nindent 6 }} template: metadata: - {{- if or .Values.forceRoll .Values.podAnnotations}} annotations: - {{- end }} - {{- with .Values.podAnnotations }} + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} - {{- end }} - {{- if .Values.forceRoll }} + {{- end }} + {{- if and .Values.mountConfig .Values.configFiles }} + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + {{- end }} + {{- if .Values.forceRoll }} rollme: {{ randAlphaNum 5 | quote }} - {{- end }} + {{- end }} labels: {{- include "zot.selectorLabels" . | nindent 8 }} spec: diff --git a/charts/zot/unittests/configmap_checksum_test.yaml b/charts/zot/unittests/configmap_checksum_test.yaml new file mode 100644 index 0000000..9d366e4 --- /dev/null +++ b/charts/zot/unittests/configmap_checksum_test.yaml @@ -0,0 +1,23 @@ +suite: configmap checksum in deployment +# Can't use global templates in this test suite as it will break the checksum calculation +# causing false negative test outcome. +# templates: +# - deployment.yaml +tests: + - it: has no checksum/config if no config + template: deployment.yaml + asserts: + - isNull: + path: spec.template.metadata.annotations.checksum/config + - it: generate checksum/config if config is present + template: deployment.yaml + set: + mountConfig: true + configFiles: + config.json: "{}" + asserts: + - isNotNull: + path: spec.template.metadata.annotations.checksum/config + - matchRegex: + path: spec.template.metadata.annotations.checksum/config + pattern: "^[a-f0-9]{64}$" # SHA256 hex output diff --git a/charts/zot/values.yaml b/charts/zot/values.yaml index 8242f51..de786c6 100644 --- a/charts/zot/values.yaml +++ b/charts/zot/values.yaml @@ -6,7 +6,7 @@ image: repository: ghcr.io/project-zot/zot-linux-amd64 pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "v2.0.1" + tag: "v2.0.2-rc1" serviceAccount: # Specifies whether a service account should be created create: true @@ -177,3 +177,6 @@ strategy: type: RollingUpdate # rollingUpdate: # maxUnavailable: 25% + +podAnnotations: {} +