Commit 6dbe0b3b authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #47693 from kow3ns/sts-e2e

Automatic merge from submit-queue (batch tested with PRs 47726, 47693, 46909, 46812) Additional e2e for StatefulSet Update **What this PR does / why we need it**: This PR adds additional e2e tests for StatefulSet update fixes: #46942 ```release-note NONE ```
parents 5e6355ca b898cf81
...@@ -488,17 +488,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet( ...@@ -488,17 +488,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
} }
// we terminate the Pod with the largest ordinal that does not match the update revision. // we terminate the Pod with the largest ordinal that does not match the update revision.
for target := len(replicas) - 1; target >= updateMin; target-- { for target := len(replicas) - 1; target >= updateMin; target-- {
// all replicas should be healthy before an update progresses we allow termination of the firstUnhealthy
// Pod in any state allow for rolling back a failed update. // delete the Pod if it is not already terminating and does not match the update revision.
if !isRunningAndReady(replicas[target]) && replicas[target] != firstUnhealthyPod { if getPodRevision(replicas[target]) != updateRevision.Name && !isTerminating(replicas[target]) {
glog.V(4).Infof(
"StatefulSet %s/%s is waiting for Pod %s to be Running and Ready prior to update",
set.Namespace,
set.Name,
firstUnhealthyPod.Name)
return &status, nil
}
if getPodRevision(replicas[target]) != updateRevision.Name {
glog.V(4).Infof("StatefulSet %s/%s terminating Pod %s for update", glog.V(4).Infof("StatefulSet %s/%s terminating Pod %s for update",
set.Namespace, set.Namespace,
set.Name, set.Name,
...@@ -507,6 +499,17 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet( ...@@ -507,6 +499,17 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
status.CurrentReplicas-- status.CurrentReplicas--
return &status, err return &status, err
} }
// wait for unhealthy Pods on update
if !isHealthy(replicas[target]) {
glog.V(4).Infof(
"StatefulSet %s/%s is waiting for Pod %s to update",
set.Namespace,
set.Name,
replicas[target].Name)
return &status, nil
}
} }
return &status, nil return &status, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment