-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Deployment with Recreate strategy not to wait on Pods in terminal phase #60301
Conversation
Per @jsafrane: "volumes are unmounted for failed or succeeded pods" - so we should be safe in that regard |
eef75a3
to
6428b9f
Compare
aff1792
to
f467a66
Compare
/kind bug /cc @kow3ns @kubernetes/sig-apps-bugs |
/test pull-kubernetes-unit |
f467a66
to
ac1c98c
Compare
tests are green :) |
}, | ||
{ | ||
name: "old RSs with zero status replicas but pods in terminal state are present", | ||
oldRSs: []*extensions.ReplicaSet{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use the same format as above test cases: []*extensions.ReplicaSet{newRSWithStatus("rs-blabla", 0, 0, nil)},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to state the tested value more verbosely in contrast to argument to a function that let's you look somewhere else for what the value means, but I have fixed it for consistency and your request.
return true | ||
for _, pod := range podList.Items { | ||
switch pod.Status.Phase { | ||
case v1.PodFailed, v1.PodSucceeded: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be impossible for RS to have succeeded pods, but there's no harm to add this check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be impossible, but a prefer to handle even such case explicitly.
case v1.PodFailed, v1.PodSucceeded: | ||
continue | ||
case v1.PodUnknown: | ||
glog.Warning("Encountered Pod %s/%s in unknown state", pod.Namespace, pod.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO I don't think we need to check unknown pods and print a warning here. Just return true
in default case should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. That doesn't conform to the logging standards for controller_manager and could get spammy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right - fixed, thx
Because ReplicaSets (and Deployments) only allow |
We should cherrypick this to 1.9. |
Removing label |
ac1c98c
to
ffdd3b5
Compare
Comments addressed. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: janetkuo, tnozicka The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@tnozicka Thanks! Would you cherrypick it to 1.8 also? |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Fixes Deployment with Recreate strategy not to wait on Pods in terminal phase. It can happen after eviction or failing to match selector and RS leaves such pod around right now. (Hopefully RC gets fixed separately.)
Which issue(s) this PR fixes *:
Fixes #60162
Special notes for your reviewer:
Release note:
/cc @janetkuo