Merge pull request #41809 from kargakis/rollout-status-fix
Automatic merge from submit-queue kubectl: respect deployment strategy parameters for rollout status Fixes https://github.com/kubernetes/kubernetes/issues/40496 `rollout status` now respects the strategy parameters for a RollingUpdate Deployment. This means that it will exit as soon as minimum availability is reached for a rollout (note that if you allow maximum availability, `rollout status` will succeed as soon as the new pods are created) @janetkuo @AdoHe ptal
This commit is contained in:
@@ -415,7 +415,7 @@ func SetReplicasAnnotations(rs *extensions.ReplicaSet, desiredReplicas, maxRepli
|
||||
|
||||
// MaxUnavailable returns the maximum unavailable pods a rolling deployment can take.
|
||||
func MaxUnavailable(deployment extensions.Deployment) int32 {
|
||||
if !IsRollingUpdate(&deployment) {
|
||||
if !IsRollingUpdate(&deployment) || *(deployment.Spec.Replicas) == 0 {
|
||||
return int32(0)
|
||||
}
|
||||
// Error caught by validation
|
||||
@@ -423,6 +423,17 @@ func MaxUnavailable(deployment extensions.Deployment) int32 {
|
||||
return maxUnavailable
|
||||
}
|
||||
|
||||
// MaxUnavailableInternal returns the maximum unavailable pods a rolling deployment can take.
|
||||
// TODO: remove the duplicate
|
||||
func MaxUnavailableInternal(deployment internalextensions.Deployment) int32 {
|
||||
if !(deployment.Spec.Strategy.Type == internalextensions.RollingUpdateDeploymentStrategyType) || deployment.Spec.Replicas == 0 {
|
||||
return int32(0)
|
||||
}
|
||||
// Error caught by validation
|
||||
_, maxUnavailable, _ := ResolveFenceposts(&deployment.Spec.Strategy.RollingUpdate.MaxSurge, &deployment.Spec.Strategy.RollingUpdate.MaxUnavailable, deployment.Spec.Replicas)
|
||||
return maxUnavailable
|
||||
}
|
||||
|
||||
// MinAvailable returns the minimum available pods of a given deployment
|
||||
func MinAvailable(deployment *extensions.Deployment) int32 {
|
||||
if !IsRollingUpdate(deployment) {
|
||||
|
Reference in New Issue
Block a user