diff --git a/charts/o-neko/Chart.yaml b/charts/o-neko/Chart.yaml index 16bd46c7..80eb6e75 100644 --- a/charts/o-neko/Chart.yaml +++ b/charts/o-neko/Chart.yaml @@ -2,11 +2,11 @@ apiVersion: v2 name: o-neko description: A Helm chart for O-Neko type: application -version: 2.3.3 +version: 2.4.0 annotations: artifacthub.io/changes: | - - kind: fixed - description: "Fixed GCP HealthCheckPolicy logConfig field name from `enable` to `enabled`" + - kind: changed + description: "Added checksum annotation to pod template to trigger pod restarts on ConfigMap changes." appVersion: "1.8.2" sources: diff --git a/charts/o-neko/templates/deployment.yaml b/charts/o-neko/templates/deployment.yaml index 1c1336c0..a1f97690 100644 --- a/charts/o-neko/templates/deployment.yaml +++ b/charts/o-neko/templates/deployment.yaml @@ -16,6 +16,8 @@ spec: revisionHistoryLimit: 10 template: metadata: + annotations: + checksum/config: {{ get (include (print $.Template.BasePath "/configmap.yaml") . | fromYaml) "data" | toYaml | sha256sum }} labels: {{- include "o-neko.selectorLabels" . | nindent 8 }} spec: serviceAccountName: {{ include "o-neko.fullname" . }} diff --git a/charts/o-neko/tests/checksum_test.yaml b/charts/o-neko/tests/checksum_test.yaml new file mode 100644 index 00000000..8635333b --- /dev/null +++ b/charts/o-neko/tests/checksum_test.yaml @@ -0,0 +1,58 @@ +suite: test checksum annotation +templates: + - deployment.yaml + - configmap.yaml +tests: + - it: should set checksum/config annotation on pod template + set: + oneko.config: + server: test + oneko.mongodb.secret.name: test-mongodb-secret + oneko.credentialsCoderKeySecret.name: test-coder-secret + oneko.credentialsCoderKeySecret.fieldName: key + asserts: + - template: deployment.yaml + exists: + path: spec.template.metadata.annotations["checksum/config"] + - it: checksum should remain the same when release name changes but data does not + release: + name: release-a + set: + oneko.config: + server: test + oneko.mongodb.secret.name: test-mongodb-secret + oneko.credentialsCoderKeySecret.name: test-coder-secret + oneko.credentialsCoderKeySecret.fieldName: key + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "033967eed51ceff9eab7efa23c999a872d11436b5be0aeca14ab40458133f7f7" + - it: checksum should remain the same when release name changes to release-b + release: + name: release-b + set: + oneko.config: + server: test + oneko.mongodb.secret.name: test-mongodb-secret + oneko.credentialsCoderKeySecret.name: test-coder-secret + oneko.credentialsCoderKeySecret.fieldName: key + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "033967eed51ceff9eab7efa23c999a872d11436b5be0aeca14ab40458133f7f7" + - it: checksum should change when config data changes + release: + name: release-a + set: + oneko.config: + server: other-server + oneko.mongodb.secret.name: test-mongodb-secret + oneko.credentialsCoderKeySecret.name: test-coder-secret + oneko.credentialsCoderKeySecret.fieldName: key + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "95c2cbb1a40531fea8093d4ba977f1a2063cde6a92883362fe6242a5643a392d" diff --git a/charts/sophora-media-finder/Chart.yaml b/charts/sophora-media-finder/Chart.yaml index e8a37de0..4b41bf09 100644 --- a/charts/sophora-media-finder/Chart.yaml +++ b/charts/sophora-media-finder/Chart.yaml @@ -2,11 +2,11 @@ apiVersion: v2 name: sophora-media-finder description: A Helm chart for Sophora Media Finder type: application -version: 0.6.3 +version: 0.7.0 annotations: artifacthub.io/changes: | - - kind: fixed - description: "Fixed GCP HealthCheckPolicy logConfig field name from `enable` to `enabled`" + - kind: changed + description: "Added checksum annotation to pod template to trigger pod restarts on ConfigMap changes." appVersion: "5.x" sources: diff --git a/charts/sophora-media-finder/templates/deployment.yaml b/charts/sophora-media-finder/templates/deployment.yaml index 7fe973bf..771b7629 100644 --- a/charts/sophora-media-finder/templates/deployment.yaml +++ b/charts/sophora-media-finder/templates/deployment.yaml @@ -11,6 +11,11 @@ spec: {{- include "sophora-media-finder.selectorLabels" . | nindent 6 }} template: metadata: + annotations: + checksum/config: {{ get (include (print $.Template.BasePath "/configmap.yaml") . | fromYaml) "data" | toYaml | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} labels: {{- include "sophora-media-finder.selectorLabels" . | nindent 8 }} spec: diff --git a/charts/sophora-media-finder/tests/checksum_test.yaml b/charts/sophora-media-finder/tests/checksum_test.yaml new file mode 100644 index 00000000..8467c85a --- /dev/null +++ b/charts/sophora-media-finder/tests/checksum_test.yaml @@ -0,0 +1,36 @@ +suite: test checksum annotation +templates: + - deployment.yaml + - configmap.yaml +tests: + - it: should set checksum/config annotation on pod template + asserts: + - template: deployment.yaml + exists: + path: spec.template.metadata.annotations["checksum/config"] + - it: checksum should remain the same when release name changes but data does not + release: + name: release-a + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "2ed5955bca0c3e22dfe1c63e944a71dd58753d8927ae373a0fd7f0181931d1b1" + - it: checksum should remain the same when release name changes to release-b + release: + name: release-b + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "2ed5955bca0c3e22dfe1c63e944a71dd58753d8927ae373a0fd7f0181931d1b1" + - it: checksum should change when config data changes + release: + name: release-a + set: + mediaFinder.configuration.ard-api.assetResearchServiceUrl: http://changed-url + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "019acc7f373ccd67ca4f7b95cff3b3ae7e0cb9d63121199fef3af80286feb66a" diff --git a/charts/sophora-media-finder/values.yaml b/charts/sophora-media-finder/values.yaml index c26c39b9..426e46a7 100644 --- a/charts/sophora-media-finder/values.yaml +++ b/charts/sophora-media-finder/values.yaml @@ -23,6 +23,8 @@ resources: limits: memory: 2Gi +podAnnotations: {} + service: type: ClusterIP port: 8080 diff --git a/charts/sophora-schema-docs/Chart.yaml b/charts/sophora-schema-docs/Chart.yaml index 78bece83..29f2d564 100644 --- a/charts/sophora-schema-docs/Chart.yaml +++ b/charts/sophora-schema-docs/Chart.yaml @@ -2,11 +2,11 @@ apiVersion: v2 name: sophora-schema-docs description: Sophora Schema Docs type: application -version: 2.5.3 +version: 2.6.0 annotations: artifacthub.io/changes: | - - kind: fixed - description: "Fixed GCP HealthCheckPolicy logConfig field name from `enable` to `enabled`" + - kind: changed + description: "Added checksum annotation to pod template to trigger pod restarts on ConfigMap changes." appVersion: 5.0.0 sources: diff --git a/charts/sophora-schema-docs/templates/deployment.yaml b/charts/sophora-schema-docs/templates/deployment.yaml index dd5cba61..1abdf2d8 100644 --- a/charts/sophora-schema-docs/templates/deployment.yaml +++ b/charts/sophora-schema-docs/templates/deployment.yaml @@ -10,10 +10,11 @@ spec: {{- include "sophora-schema-docs.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: + checksum/config: {{ get (include (print $.Template.BasePath "/configmap.yaml") . | fromYaml) "data" | toYaml | sha256sum }} + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} labels: {{- include "sophora-schema-docs.selectorLabels" . | nindent 8 }} spec: diff --git a/charts/sophora-schema-docs/tests/checksum_test.yaml b/charts/sophora-schema-docs/tests/checksum_test.yaml new file mode 100644 index 00000000..64723c22 --- /dev/null +++ b/charts/sophora-schema-docs/tests/checksum_test.yaml @@ -0,0 +1,43 @@ +suite: test checksum annotation +templates: + - deployment.yaml + - configmap.yaml +tests: + - it: should set checksum/config annotation on pod template + set: + sophora.authentication.secret.name: test-secret + asserts: + - template: deployment.yaml + exists: + path: spec.template.metadata.annotations["checksum/config"] + - it: checksum should remain the same when release name changes but data does not + release: + name: release-a + set: + sophora.authentication.secret.name: test-secret + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "49b537f0b9ac9f3537ec40861ed69c1b6afacfb42bc6d638faeaf797a02c29c5" + - it: checksum should remain the same when release name changes to release-b + release: + name: release-b + set: + sophora.authentication.secret.name: test-secret + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "49b537f0b9ac9f3537ec40861ed69c1b6afacfb42bc6d638faeaf797a02c29c5" + - it: checksum should change when config data changes + release: + name: release-a + set: + sophora.authentication.secret.name: test-secret + sophora.configuration.server.port: 9090 + asserts: + - template: deployment.yaml + equal: + path: spec.template.metadata.annotations["checksum/config"] + value: "a186968c70fd33b0c041644ca9c20d996ab28f462083ef4ccfb391b48d82ca71"