Skip to content

Commit 2a969f0

Browse files
authored
Merge pull request #1104 from rackerlabs/fix-job-sync
fix: update job hook settings for ArgoCD for OpenStack Helm
2 parents a169d75 + d021a8f commit 2a969f0

File tree

10 files changed

+327
-155
lines changed

10 files changed

+327
-155
lines changed

components/cinder/values.yaml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,39 +136,60 @@ manifests:
136136
service_ingress_api: false
137137
deployment_backup: false
138138

139-
# We don't want to enable OpenStack Helm's
140-
# helm.sh/hooks because they set them as
141-
# post-install,post-upgrade which in ArgoCD
142-
# maps to PostSync. However the deployments
143-
# and statefulsets in OpenStack Helm
144-
# depend on the jobs to complete to become
145-
# healthy. Which they cannot because they are in
146-
# the post step and not in the main step.
147-
# Turning this on results in the keys jobs
148-
# editing the annotation which deletes the item
149-
# and wipes our keys.
150-
helm3_hook: false
151-
152139
annotations:
140+
# we need to modify the annotations on OpenStack Helm
141+
# jobs because they use helm.sh/hooks: post-install,post-upgrade
142+
# which means they will get applied in the post phase which
143+
# is after the API deployment. With standard helm this works
144+
# out because it just orders how things are applied but with
145+
# ArgoCD it will wait until the sync phase is successful.
146+
# Unfortunately the API deployments need several jobs to occur
147+
# before it will go successful like creating the keystone user,
148+
# service, endpoints and syncing the DB. These jobs also have
149+
# a helm.sh/hook-weight to order them which is good but by moving
150+
# them to the sync phase the weight is now wrong with resources
151+
# they depend on like secrets and configmaps so we need to
152+
# override them to 0 because there is no way in OpenStack Helm
153+
# to set annotations on deployments and daemonssets nicely.
154+
# Other jobs might need to be moved as well. We do this by
155+
# moving them to the sync phase. Additionally since the jobs
156+
# are using fixed names and not generated names for each run
157+
# ArgoCD attempts to edit them but they have immutable fields
158+
# so we must force the replacement instead of attempting to diff them.
159+
# Lastly the hook-delete-policy controls the finalizer which
160+
# prevents the deletion of the job. In this case we're saying
161+
# the old job needs to be removed before applying the new one
162+
# which gets around the immutable case above.
153163
job:
154164
cinder_db_sync:
155165
argocd.argoproj.io/hook: Sync
156166
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
167+
argocd.argoproj.io/sync-options: Force=true
168+
argocd.argoproj.io/sync-wave: "0"
157169
cinder_ks_service:
158170
argocd.argoproj.io/hook: Sync
159171
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
172+
argocd.argoproj.io/sync-options: Force=true
173+
argocd.argoproj.io/sync-wave: "0"
160174
cinder_ks_user:
161175
argocd.argoproj.io/hook: Sync
162176
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
177+
argocd.argoproj.io/sync-options: Force=true
178+
argocd.argoproj.io/sync-wave: "0"
163179
cinder_ks_endpoints:
164180
argocd.argoproj.io/hook: Sync
165181
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
182+
argocd.argoproj.io/sync-options: Force=true
183+
argocd.argoproj.io/sync-wave: "0"
166184
cinder_image_repo_sync:
167185
argocd.argoproj.io/hook: Sync
168186
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
187+
argocd.argoproj.io/sync-options: Force=true
169188
cinder_clean:
170189
argocd.argoproj.io/hook: Sync
171190
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
191+
argocd.argoproj.io/sync-options: Force=true
172192
cinder_create_internal_tenant:
173193
argocd.argoproj.io/hook: Sync
174194
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
195+
argocd.argoproj.io/sync-options: Force=true

components/glance/values.yaml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,39 +112,60 @@ manifests:
112112
secret_keystone: true
113113
service_ingress_api: false
114114

115-
# We don't want to enable OpenStack Helm's
116-
# helm.sh/hooks because they set them as
117-
# post-install,post-upgrade which in ArgoCD
118-
# maps to PostSync. However the deployments
119-
# and statefulsets in OpenStack Helm
120-
# depend on the jobs to complete to become
121-
# healthy. Which they cannot because they are in
122-
# the post step and not in the main step.
123-
# Turning this on results in the keys jobs
124-
# editing the annotation which deletes the item
125-
# and wipes our keys.
126-
helm3_hook: false
127-
128115
annotations:
116+
# we need to modify the annotations on OpenStack Helm
117+
# jobs because they use helm.sh/hooks: post-install,post-upgrade
118+
# which means they will get applied in the post phase which
119+
# is after the API deployment. With standard helm this works
120+
# out because it just orders how things are applied but with
121+
# ArgoCD it will wait until the sync phase is successful.
122+
# Unfortunately the API deployments need several jobs to occur
123+
# before it will go successful like creating the keystone user,
124+
# service, endpoints and syncing the DB. These jobs also have
125+
# a helm.sh/hook-weight to order them which is good but by moving
126+
# them to the sync phase the weight is now wrong with resources
127+
# they depend on like secrets and configmaps so we need to
128+
# override them to 0 because there is no way in OpenStack Helm
129+
# to set annotations on deployments and daemonssets nicely.
130+
# Other jobs might need to be moved as well. We do this by
131+
# moving them to the sync phase. Additionally since the jobs
132+
# are using fixed names and not generated names for each run
133+
# ArgoCD attempts to edit them but they have immutable fields
134+
# so we must force the replacement instead of attempting to diff them.
135+
# Lastly the hook-delete-policy controls the finalizer which
136+
# prevents the deletion of the job. In this case we're saying
137+
# the old job needs to be removed before applying the new one
138+
# which gets around the immutable case above.
129139
job:
130140
glance_db_sync:
131141
argocd.argoproj.io/hook: Sync
132142
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
143+
argocd.argoproj.io/sync-options: Force=true
144+
argocd.argoproj.io/sync-wave: "0"
133145
glance_ks_service:
134146
argocd.argoproj.io/hook: Sync
135147
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
148+
argocd.argoproj.io/sync-options: Force=true
149+
argocd.argoproj.io/sync-wave: "0"
136150
glance_ks_user:
137151
argocd.argoproj.io/hook: Sync
138152
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
153+
argocd.argoproj.io/sync-options: Force=true
154+
argocd.argoproj.io/sync-wave: "0"
139155
glance_ks_endpoints:
140156
argocd.argoproj.io/hook: Sync
141157
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
158+
argocd.argoproj.io/sync-options: Force=true
159+
argocd.argoproj.io/sync-wave: "0"
142160
glance_metadefs_load:
143161
argocd.argoproj.io/hook: Sync
144162
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
163+
argocd.argoproj.io/sync-options: Force=true
145164
glance_storage_init:
146165
argocd.argoproj.io/hook: Sync
147166
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
167+
argocd.argoproj.io/sync-options: Force=true
148168
glance_bootstrap:
149-
argocd.argoproj.io/hook: Sync
169+
# relies on the services to be up so it can be post
150170
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
171+
argocd.argoproj.io/sync-options: Force=true

components/horizon/values.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,33 @@ pod:
7777
# usually set on per-deployment basis.
7878
min_available: 0
7979

80-
# We don't want to enable OpenStack Helm's
81-
# helm.sh/hooks because they set them as
82-
# post-install,post-upgrade which in ArgoCD
83-
# maps to PostSync. However the deployments
84-
# and statefulsets in OpenStack Helm
85-
# depend on the jobs to complete to become
86-
# healthy. Which they cannot because they are in
87-
# the post step and not in the main step.
88-
# Turning this on results in the keys jobs
89-
# editing the annotation which deletes the item
90-
# and wipes our keys.
91-
helm3_hook: false
92-
9380
annotations:
81+
# we need to modify the annotations on OpenStack Helm
82+
# jobs because they use helm.sh/hooks: post-install,post-upgrade
83+
# which means they will get applied in the post phase which
84+
# is after the API deployment. With standard helm this works
85+
# out because it just orders how things are applied but with
86+
# ArgoCD it will wait until the sync phase is successful.
87+
# Unfortunately the API deployments need several jobs to occur
88+
# before it will go successful like creating the keystone user,
89+
# service, endpoints and syncing the DB. These jobs also have
90+
# a helm.sh/hook-weight to order them which is good but by moving
91+
# them to the sync phase the weight is now wrong with resources
92+
# they depend on like secrets and configmaps so we need to
93+
# override them to 0 because there is no way in OpenStack Helm
94+
# to set annotations on deployments and daemonssets nicely.
95+
# Other jobs might need to be moved as well. We do this by
96+
# moving them to the sync phase. Additionally since the jobs
97+
# are using fixed names and not generated names for each run
98+
# ArgoCD attempts to edit them but they have immutable fields
99+
# so we must force the replacement instead of attempting to diff them.
100+
# Lastly the hook-delete-policy controls the finalizer which
101+
# prevents the deletion of the job. In this case we're saying
102+
# the old job needs to be removed before applying the new one
103+
# which gets around the immutable case above.
94104
job:
95105
horizon_db_sync:
96106
argocd.argoproj.io/hook: Sync
97107
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
108+
argocd.argoproj.io/sync-options: Force=true
109+
argocd.argoproj.io/sync-wave: "0"

components/ironic/values.yaml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,30 +220,48 @@ pod:
220220
# usually set on per-deployment basis.
221221
min_available: 0
222222

223-
# we don't want to enable OpenStack Helm's
224-
# helm.sh/hooks because they set them as
225-
# post-install,post-upgrade which in ArgoCD
226-
# maps to PostSync. However the deployments
227-
# and statefulsets in OpenStack Helm
228-
# depend on the jobs to complete to become
229-
# healthy. Which they cannot because they are in
230-
# the post step and not in the main step.
231-
# Turning this on results in the keys jobs
232-
# editing the annotation which deletes the item
233-
# and wipes our keys.
234-
helm3_hook: false
235-
236223
annotations:
224+
# we need to modify the annotations on OpenStack Helm
225+
# jobs because they use helm.sh/hooks: post-install,post-upgrade
226+
# which means they will get applied in the post phase which
227+
# is after the API deployment. With standard helm this works
228+
# out because it just orders how things are applied but with
229+
# ArgoCD it will wait until the sync phase is successful.
230+
# Unfortunately the API deployments need several jobs to occur
231+
# before it will go successful like creating the keystone user,
232+
# service, endpoints and syncing the DB. These jobs also have
233+
# a helm.sh/hook-weight to order them which is good but by moving
234+
# them to the sync phase the weight is now wrong with resources
235+
# they depend on like secrets and configmaps so we need to
236+
# override them to 0 because there is no way in OpenStack Helm
237+
# to set annotations on deployments and daemonssets nicely.
238+
# Other jobs might need to be moved as well. We do this by
239+
# moving them to the sync phase. Additionally since the jobs
240+
# are using fixed names and not generated names for each run
241+
# ArgoCD attempts to edit them but they have immutable fields
242+
# so we must force the replacement instead of attempting to diff them.
243+
# Lastly the hook-delete-policy controls the finalizer which
244+
# prevents the deletion of the job. In this case we're saying
245+
# the old job needs to be removed before applying the new one
246+
# which gets around the immutable case above.
237247
job:
238248
ironic_db_sync:
239249
argocd.argoproj.io/hook: Sync
240250
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
251+
argocd.argoproj.io/sync-options: Force=true
252+
argocd.argoproj.io/sync-wave: "0"
241253
ironic_ks_service:
242254
argocd.argoproj.io/hook: Sync
243255
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
256+
argocd.argoproj.io/sync-options: Force=true
257+
argocd.argoproj.io/sync-wave: "0"
244258
ironic_ks_user:
245259
argocd.argoproj.io/hook: Sync
246260
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
261+
argocd.argoproj.io/sync-options: Force=true
262+
argocd.argoproj.io/sync-wave: "0"
247263
ironic_ks_endpoints:
248264
argocd.argoproj.io/hook: Sync
249265
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
266+
argocd.argoproj.io/sync-options: Force=true
267+
argocd.argoproj.io/sync-wave: "0"

components/keystone/values.yaml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -289,33 +289,51 @@ manifests:
289289
secret_keystone: true
290290
service_ingress_api: false
291291

292-
# we don't want to enable OpenStack Helm's
293-
# helm.sh/hooks because they set them as
294-
# post-install,post-upgrade which in ArgoCD
295-
# maps to PostSync. However the deployments
296-
# and statefulsets in OpenStack Helm
297-
# depend on the jobs to complete to become
298-
# healthy. Which they cannot because they are in
299-
# the post step and not in the main step.
300-
# Turning this on results in the keys jobs
301-
# editing the annotation which deletes the item
302-
# and wipes our keys.
303-
helm3_hook: false
304-
305292
annotations:
293+
# we need to modify the annotations on OpenStack Helm
294+
# jobs because they use helm.sh/hooks: post-install,post-upgrade
295+
# which means they will get applied in the post phase which
296+
# is after the API deployment. With standard helm this works
297+
# out because it just orders how things are applied but with
298+
# ArgoCD it will wait until the sync phase is successful.
299+
# Unfortunately the API deployments need several jobs to occur
300+
# before it will go successful like creating the keystone user,
301+
# service, endpoints and syncing the DB. These jobs also have
302+
# a helm.sh/hook-weight to order them which is good but by moving
303+
# them to the sync phase the weight is now wrong with resources
304+
# they depend on like secrets and configmaps so we need to
305+
# override them to 0 because there is no way in OpenStack Helm
306+
# to set annotations on deployments and daemonssets nicely.
307+
# Other jobs might need to be moved as well. We do this by
308+
# moving them to the sync phase. Additionally since the jobs
309+
# are using fixed names and not generated names for each run
310+
# ArgoCD attempts to edit them but they have immutable fields
311+
# so we must force the replacement instead of attempting to diff them.
312+
# Lastly the hook-delete-policy controls the finalizer which
313+
# prevents the deletion of the job. In this case we're saying
314+
# the old job needs to be removed before applying the new one
315+
# which gets around the immutable case above.
306316
job:
307-
keystone_fernet_setup:
317+
keystone_db_sync:
308318
argocd.argoproj.io/hook: Sync
309319
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
310-
keystone_db_sync:
320+
argocd.argoproj.io/sync-options: Force=true
321+
argocd.argoproj.io/sync-wave: "0"
322+
keystone_fernet_setup:
311323
argocd.argoproj.io/hook: Sync
312324
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
325+
argocd.argoproj.io/sync-options: Force=true
326+
argocd.argoproj.io/sync-wave: "0"
313327
keystone_credential_setup:
314328
argocd.argoproj.io/hook: Sync
315329
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
330+
argocd.argoproj.io/sync-options: Force=true
331+
argocd.argoproj.io/sync-wave: "0"
316332
keystone_domain_manage:
317333
argocd.argoproj.io/hook: Sync
318334
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
335+
argocd.argoproj.io/sync-options: Force=true
319336
keystone_bootstrap:
320-
argocd.argoproj.io/hook: Sync
337+
# relies on services to be up so it can remain post
321338
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
339+
argocd.argoproj.io/sync-options: Force=true

components/neutron/values.yaml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,30 +199,48 @@ manifests:
199199
deployment_ironic_agent: true
200200
service_ingress_server: false
201201

202-
# We don't want to enable OpenStack Helm's
203-
# helm.sh/hooks because they set them as
204-
# post-install,post-upgrade which in ArgoCD
205-
# maps to PostSync. However the deployments
206-
# and statefulsets in OpenStack Helm
207-
# depend on the jobs to complete to become
208-
# healthy. Which they cannot because they are in
209-
# the post step and not in the main step.
210-
# Turning this on results in the keys jobs
211-
# editing the annotation which deletes the item
212-
# and wipes our keys.
213-
helm3_hook: false
214-
215202
annotations:
203+
# we need to modify the annotations on OpenStack Helm
204+
# jobs because they use helm.sh/hooks: post-install,post-upgrade
205+
# which means they will get applied in the post phase which
206+
# is after the API deployment. With standard helm this works
207+
# out because it just orders how things are applied but with
208+
# ArgoCD it will wait until the sync phase is successful.
209+
# Unfortunately the API deployments need several jobs to occur
210+
# before it will go successful like creating the keystone user,
211+
# service, endpoints and syncing the DB. These jobs also have
212+
# a helm.sh/hook-weight to order them which is good but by moving
213+
# them to the sync phase the weight is now wrong with resources
214+
# they depend on like secrets and configmaps so we need to
215+
# override them to 0 because there is no way in OpenStack Helm
216+
# to set annotations on deployments and daemonssets nicely.
217+
# Other jobs might need to be moved as well. We do this by
218+
# moving them to the sync phase. Additionally since the jobs
219+
# are using fixed names and not generated names for each run
220+
# ArgoCD attempts to edit them but they have immutable fields
221+
# so we must force the replacement instead of attempting to diff them.
222+
# Lastly the hook-delete-policy controls the finalizer which
223+
# prevents the deletion of the job. In this case we're saying
224+
# the old job needs to be removed before applying the new one
225+
# which gets around the immutable case above.
216226
job:
217227
neutron_db_sync:
218228
argocd.argoproj.io/hook: Sync
219229
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
230+
argocd.argoproj.io/sync-options: Force=true
231+
argocd.argoproj.io/sync-wave: "0"
220232
neutron_ks_service:
221233
argocd.argoproj.io/hook: Sync
222234
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
235+
argocd.argoproj.io/sync-options: Force=true
236+
argocd.argoproj.io/sync-wave: "0"
223237
neutron_ks_user:
224238
argocd.argoproj.io/hook: Sync
225239
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
240+
argocd.argoproj.io/sync-options: Force=true
241+
argocd.argoproj.io/sync-wave: "0"
226242
neutron_ks_endpoints:
227243
argocd.argoproj.io/hook: Sync
228244
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
245+
argocd.argoproj.io/sync-options: Force=true
246+
argocd.argoproj.io/sync-wave: "0"

0 commit comments

Comments
 (0)