Skip to content

Commit

Permalink
operator: consider draining field when checking maintenance mode status
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Jun 3, 2022
1 parent 993d9c4 commit f0a5fca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/go/k8s/pkg/resources/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func (r *StatefulSetResource) getPreStopHook() *corev1.Handler {
curlGetCommand := r.composeCURLMaintenanceCommand(`--silent`, &genericMaintenancePath)
cmd := fmt.Sprintf(`until [ "${status:-}" = "200" ]; do status=$(%s); sleep 0.5; done`, curlCommand) +
" && " +
fmt.Sprintf(`until [ "${finished:-}" = "true" ]; do finished=$(%s | grep -o '\"finished\":[^,}]*' | grep -o '[^: ]*$'); sleep 0.5; done`, curlGetCommand)
fmt.Sprintf(`until [ "${finished:-}" = "true" ] || [ "${draining:-}" = "false" ]; do res=$(%s); finished=$(echo $res | grep -o '\"finished\":[^,}]*' | grep -o '[^: ]*$'); draining=$(echo $res | grep -o '\"draining\":[^,}]*' | grep -o '[^: ]*$'); sleep 0.5; done`, curlGetCommand)

return &corev1.Handler{
Exec: &corev1.ExecAction{
Expand Down

0 comments on commit f0a5fca

Please sign in to comment.