Skip to content

Commit 885f681

Browse files
authored
fix: add checksum to force a restart when ConfigMaps or Secrets change (#66)
* fix: add checksum to force restart * fix: define configmap and secrets templates, add checksum annotations to statefulsets * test: add missing templates to statefulset tests * fix: update chart version to 0.2.0 for geoserver and mapstore
1 parent d5f0111 commit 885f681

File tree

9 files changed

+24
-3
lines changed

9 files changed

+24
-3
lines changed

geoserver/latest/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.2.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

geoserver/latest/templates/configmap.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- define "geoserver.configmap" -}}
12
apiVersion: v1
23
kind: ConfigMap
34
metadata:
@@ -175,3 +176,5 @@ data:
175176
</Engine>
176177
</Service>
177178
</Server>
179+
{{- end -}}
180+
{{- include "geoserver.configmap" . -}}

geoserver/latest/templates/secrets.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- define "geoserver.secrets" -}}
12
apiVersion: v1
23
kind: Secret
34
metadata:
@@ -15,3 +16,5 @@ metadata:
1516
data:
1617
context.xml: |-
1718
{{ .Files.Get "context.xml" | b64enc }}
19+
{{- end -}}
20+
{{- include "geoserver.secrets" . -}}

geoserver/latest/templates/statefulset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ spec:
1515
template:
1616
metadata:
1717
annotations:
18+
checksum/config: {{ include "geoserver.configmap" . | sha256sum }}
19+
checksum/secrets: {{ include "geoserver.secrets" . | sha256sum }}
1820
{{- with .Values.podAnnotations }}
1921
{{- toYaml . | nindent 8 }}
2022
{{- end }}

geoserver/latest/tests/statefulset_test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
suite: test statefulset
22
templates:
3+
- configmap.yml
4+
- secrets.yaml
35
- env-properties-secret.yaml
46
- statefulset.yaml
57
tests:

mapstore/latest/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: 0.2.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
{{- define "mapstore.ovr-secret" -}}
12
apiVersion: v1
23
kind: Secret
34
metadata:
45
name: {{ include "mapstore.fullname" . }}-ovr
56
data:
67
geostore-datasource-ovr.properties: |-
7-
{{ .Files.Get "geostore-datasource-ovr.properties" | b64enc }}
8+
{{ .Files.Get "geostore-datasource-ovr.properties" | b64enc }}
9+
{{- end -}}
10+
{{- include "mapstore.ovr-secret" . -}}

mapstore/latest/templates/statefulset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ spec:
1212
{{- include "mapstore.selectorLabels" . | nindent 6 }}
1313
template:
1414
metadata:
15+
annotations:
16+
checksum/secrets: {{ include "mapstore.ovr-secret" . | sha256sum }}
1517
labels:
1618
{{- include "mapstore.selectorLabels" . | nindent 8 }}
1719
spec:

mapstore/latest/tests/statefulset_test.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
suite: test statefulset
22
templates:
3+
- ovr-secret.yaml
34
- statefulset.yaml
45
tests:
56
- it: should create a statefulset
7+
template: statefulset.yaml
68
asserts:
79
- isKind:
810
of: StatefulSet
@@ -11,12 +13,14 @@ tests:
1113
value: RELEASE-NAME-mapstore
1214

1315
- it: should use correct image
16+
template: statefulset.yaml
1417
asserts:
1518
- equal:
1619
path: spec.template.spec.containers[0].image
1720
value: geosolutionsit/mapstore2:latest
1821

1922
- it: should set custom image
23+
template: statefulset.yaml
2024
set:
2125
image.name: custom/mapstore
2226
image.tag: "2.0.0"
@@ -26,6 +30,7 @@ tests:
2630
value: custom/mapstore:2.0.0
2731

2832
- it: should have correct labels
33+
template: statefulset.yaml
2934
asserts:
3035
- equal:
3136
path: metadata.labels["app.kubernetes.io/name"]
@@ -35,6 +40,7 @@ tests:
3540
value: RELEASE-NAME
3641

3742
- it: should have correct ports
43+
template: statefulset.yaml
3844
asserts:
3945
- contains:
4046
path: spec.template.spec.containers[0].ports

0 commit comments

Comments
 (0)