Skip to content

Commit 9dbd393

Browse files
committed
Ensure that holder-update DaemonSet pods are restarted on script changes
We add the script's md5sum as an annotation to the DaemonSet pod template to force Kubernetes to recreate the pods when we modify the script. Additionally, we set `sync-wave=10` for the DaemonSet to ensure that the ConfigMap changes are synced before the checksum annotation on the DaemonSet is updated.
1 parent 32e1338 commit 9dbd393

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

component/restart-holder-ds.libsonnet

+8
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,19 @@ local daemonset = kube.DaemonSet('syn-holder-updater') {
8989
'non-daemonset pods are running on the node) and then deletes any ' +
9090
'outdated csi holder pods. Outdated holder pods are identified by ' +
9191
'comparing the DaemonSet generation with the pod generation.',
92+
// set sync wave 10 for the daemonset to ensure that the ConfigMap is
93+
// updated first.
94+
'argocd.argoproj.io/sync-wave': '10',
9295
},
9396
namespace: params.namespace,
9497
},
9598
spec+: {
9699
template+: {
100+
metadata+: {
101+
annotations+: {
102+
'script-checksum': std.md5(script),
103+
},
104+
},
97105
spec+: {
98106
serviceAccountName: serviceaccount.metadata.name,
99107
containers_: {

tests/golden/cephfs/rook-ceph/rook-ceph/50_restart_holder_ds.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ spec:
123123
name: syn-holder-updater
124124
template:
125125
metadata:
126-
annotations: {}
126+
annotations:
127+
script-checksum: 488da91788ef6e501cece9d3d67ff8b0
127128
labels:
128129
app.kubernetes.io/component: rook-ceph
129130
app.kubernetes.io/managed-by: commodore

tests/golden/defaults/rook-ceph/rook-ceph/50_restart_holder_ds.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ spec:
123123
name: syn-holder-updater
124124
template:
125125
metadata:
126-
annotations: {}
126+
annotations:
127+
script-checksum: 488da91788ef6e501cece9d3d67ff8b0
127128
labels:
128129
app.kubernetes.io/component: rook-ceph
129130
app.kubernetes.io/managed-by: commodore

tests/golden/openshift4/rook-ceph/rook-ceph/50_restart_holder_ds.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ spec:
123123
name: syn-holder-updater
124124
template:
125125
metadata:
126-
annotations: {}
126+
annotations:
127+
script-checksum: 488da91788ef6e501cece9d3d67ff8b0
127128
labels:
128129
app.kubernetes.io/component: rook-ceph
129130
app.kubernetes.io/managed-by: commodore

0 commit comments

Comments
 (0)