Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pkg/kube): statefulSetReady: handle partition cases correctly
The partition value can be greater than number of replicas, in that case no pods are rolled out. The expectedReplicas becomes a negative number. https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions In the cases where the update does not change anything in the pod template, the updatedReplicas value from StatefulSet status remains unchanged. Such updates can still set some partition value, and UpdatedReplicas is always greater than expectedReplicas. Basically, the StatefulSet is ready / rolled-out. In both the above scenarios, providing `--wait` flag causes it to timeout waiting indefinitely. Because updatedReplicas can never be negative, or be equal to the expectedReplicas for the second case. This commit handles both the scenarios by checking if UpdatedReplicas is smaller than expectedReplicas. If it is, then the StatefulSet is not ready yet. Based on the code from kubectl rollout: https://github.com/kubernetes/kubectl/blob/a450ebd59c1e8917df23d37c6f05d8e16c3746aa/pkg/polymorphichelpers/rollout_status.go#L138-L141 Closes #8674 Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
- Loading branch information