Skip to content
6 changes: 3 additions & 3 deletions charts/o-neko/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v2
name: o-neko
description: A Helm chart for O-Neko
type: application
version: 2.1.0
version: 2.2.0
annotations:
artifacthub.io/changes: |
- kind: added
description: "Added HTTPRoute support for Gateway API"
- kind: changed
description: "Added checksum annotation to pod template to trigger pod restarts on ConfigMap changes."

appVersion: "1.8.2"
sources:
Expand Down
2 changes: 2 additions & 0 deletions charts/o-neko/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down
58 changes: 58 additions & 0 deletions charts/o-neko/tests/checksum_test.yaml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 3 additions & 3 deletions charts/sophora-media-finder/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v2
name: sophora-media-finder
description: A Helm chart for Sophora Media Finder
type: application
version: 0.3.0
version: 0.4.0
annotations:
artifacthub.io/changes: |
- kind: added
description: "Added HTTPRoute support for Gateway API."
- kind: changed
description: "Added checksum annotation to pod template to trigger pod restarts on ConfigMap changes."

appVersion: "5.x"
sources:
Expand Down
5 changes: 5 additions & 0 deletions charts/sophora-media-finder/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Comment thread
DanielRaapDev marked this conversation as resolved.
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "sophora-media-finder.selectorLabels" . | nindent 8 }}
spec:
Expand Down
36 changes: 36 additions & 0 deletions charts/sophora-media-finder/tests/checksum_test.yaml
Original file line number Diff line number Diff line change
@@ -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: "a1c53f0240e0d2df333eeb4e5b2767cd314f098933ce69df990660f8e065f0f5"
- 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: "a1c53f0240e0d2df333eeb4e5b2767cd314f098933ce69df990660f8e065f0f5"
- 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: "74d2c40066a009d4c3f9d95d939c702119bf437332602fc787301fbd802f68b6"
2 changes: 2 additions & 0 deletions charts/sophora-media-finder/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ resources:
limits:
memory: 2Gi

podAnnotations: {}

service:
type: ClusterIP
port: 8080
Expand Down
6 changes: 3 additions & 3 deletions charts/sophora-schema-docs/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v2
name: sophora-schema-docs
description: Sophora Schema Docs
type: application
version: 2.2.0
version: 2.3.0
annotations:
artifacthub.io/changes: |
- kind: added
description: "Added HTTPRoute support for Gateway API."
- kind: changed
description: "Added checksum annotation to pod template to trigger pod restarts on ConfigMap changes."

appVersion: 5.0.0
sources:
Expand Down
5 changes: 3 additions & 2 deletions charts/sophora-schema-docs/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
43 changes: 43 additions & 0 deletions charts/sophora-schema-docs/tests/checksum_test.yaml
Original file line number Diff line number Diff line change
@@ -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"