Skip to content

Commit 0f780bb

Browse files
Improve ensure statefulset to wait for readiness and bailout on crash
This change updates the ensureStatefulset helpers to fully wait for service readiness based on the graceful period Change-Id: I8cf8d07608203546eb712518c6f7d1d493166733
1 parent 6c2bd66 commit 0f780bb

7 files changed

Lines changed: 8 additions & 7 deletions

File tree

controllers/git_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func (r *SFController) DeployGitServer() bool {
370370
svcRW := base.MkServicePod(GitServerIdentRW, r.Ns, GitServerIdent+"-0", []int32{gsGitPortRW}, gsGitPortName, r.cr.Spec.ExtraLabels)
371371
r.EnsureService(&svcRW)
372372

373-
ready := r.IsStatefulSetReady(current)
373+
ready := r.waitStatefulset(current)
374374
conds.UpdateConditions(&r.cr.Status.Conditions, GitServerIdent, ready)
375375

376376
return ready

controllers/hound-search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (r *SFController) DeployHoundSearch() bool {
133133
houndSearchIdent+"-data-"+houndSearchIdent+"-0",
134134
r.cr.Spec.Codesearch.Storage)
135135

136-
isReady := r.IsStatefulSetReady(current) && pvcReadiness
136+
isReady := pvcReadiness && r.waitStatefulset(current)
137137
conds.UpdateConditions(&r.cr.Status.Conditions, houndSearchIdent, isReady)
138138

139139
return isReady

controllers/logserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (r *SFController) DeployLogserver() bool {
257257

258258
pvcReadiness := r.reconcileExpandPVC(logserverIdent+"-"+logserverIdent+"-0", r.cr.Spec.Logserver.Storage)
259259

260-
isReady := r.IsStatefulSetReady(current) && !stsUpdated && pvcReadiness
260+
isReady := !stsUpdated && pvcReadiness && r.waitStatefulset(current)
261261

262262
// When sts is ready, we can consider logserver ready and we can update the keys
263263
// Reconcile SSH keys dynamically without pod restart

controllers/mariadb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ GRANT ALL ON *.* TO root@'%%' WITH GRANT OPTION;`,
278278

279279
var zuulDBSecret apiv1.Secret
280280

281-
stsReady := r.IsStatefulSetReady(current)
281+
stsReady := r.waitStatefulset(current)
282282

283283
postReady := false
284284
if stsReady {

controllers/zookeeper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (r *SFController) DeployZookeeper() bool {
260260
pvcReadiness = pvcReadiness && r.reconcileExpandPVC(pvcName, r.cr.Spec.Zookeeper.Storage)
261261
}
262262

263-
isReady := r.IsStatefulSetReady(current) && pvcReadiness
263+
isReady := pvcReadiness && r.waitStatefulset(current)
264264
conds.UpdateConditions(&r.cr.Status.Conditions, ZookeeperIdent, isReady)
265265

266266
return isReady

controllers/zuul.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ func (r *SFController) EnsureZuulScheduler(cfg *ini.File) bool {
621621
return false
622622
}
623623

624-
ready := r.IsStatefulSetReady(current)
624+
ready := r.waitStatefulset(current)
625625
conds.UpdateConditions(&r.cr.Status.Conditions, "zuul-scheduler", ready)
626626

627627
if ready {
@@ -797,7 +797,7 @@ func (r *SFController) EnsureZuulMerger(cfg *ini.File) bool {
797797

798798
pvcReadiness := r.reconcileExpandPVCs("zuul-merger", r.cr.Spec.Zuul.Merger.Storage)
799799

800-
ready := r.IsStatefulSetReady(current) && pvcReadiness
800+
ready := pvcReadiness && r.waitStatefulset(current)
801801
conds.UpdateConditions(&r.cr.Status.Conditions, service, ready)
802802

803803
return ready

docs/reference/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
1111
### Changed
1212

1313
- Zuul Executor: wait until the grace period is over for the statefulset to be ready. This is to ensure progressive rollout where the sf-operator can now safely proceed one executors at a time without interrupting the production.
14+
- Improved statefulset readiness deployment to wait for the grace period and bail out early in case of crash back loop.
1415

1516
### Deprecated
1617
### Removed

0 commit comments

Comments
 (0)