From 85e3194cf62403240a336c2c7091fb657e7c459f Mon Sep 17 00:00:00 2001 From: FillZpp Date: Mon, 16 May 2022 16:58:19 +0800 Subject: [PATCH] Fix maxUnavailable of StatefulSet should not less than 1 Signed-off-by: FillZpp --- pkg/controller/statefulset/stateful_set_control.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/controller/statefulset/stateful_set_control.go b/pkg/controller/statefulset/stateful_set_control.go index ba18fb0a5f1..5350fc24fd4 100644 --- a/pkg/controller/statefulset/stateful_set_control.go +++ b/pkg/controller/statefulset/stateful_set_control.go @@ -618,7 +618,11 @@ func updateStatefulSetAfterInvariantEstablished( if err != nil { return &status, err } - + // maxUnavailable might be zero for small percentage without round up. + // So we have to enforce it not to be less than 1. + if maxUnavailable < 1 { + maxUnavailable = 1 + } } // Collect all targets in the range between the 0 and Spec.Replicas. Count any targets in that range