-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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 helper - no assumptions on only one new ReplicaSet #41851
Fix deployment helper - no assumptions on only one new ReplicaSet #41851
Conversation
[APPROVALNOTIFIER] This PR is APPROVED The following people have approved this PR: janetkuo Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
1fad439
to
ff6047b
Compare
/lgtm We should cherry-pick this to 1.5 |
cc @mwielgus for cherrypick approval |
@k8s-bot gce etcd3 e2e test this |
@@ -612,9 +612,10 @@ func EqualIgnoreHash(template1, template2 v1.PodTemplateSpec) bool { | |||
// FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template). | |||
func FindNewReplicaSet(deployment *extensions.Deployment, rsList []*extensions.ReplicaSet) (*extensions.ReplicaSet, error) { | |||
newRSTemplate := GetNewReplicaSetTemplate(deployment) | |||
sort.Sort(controller.ReplicaSetsByCreationTimestamp(rsList)) |
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.
@smarterclayton @mfojtik we are going to choose the oldest replica set out of two identical replica sets for now - seems like the sanest thing to do when we end up in such a state (seems possible after cluster upgrades: #40415).
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.
@janetkuo can you add a comment explaining this here?
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.
done
// Filter out replica set that has the same pod template spec as the deployment - that is the new replica set. | ||
if EqualIgnoreHash(rs.Spec.Template, newRSTemplate) { | ||
// Filter out new replica set | ||
if rs == nil || (newRS != nil && rs.UID == newRS.UID) { |
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.
rs cannot be nil here.
newRS, err := FindNewReplicaSet(deployment, rsList) | ||
if err != nil { | ||
return requiredRSs, allRSs, err | ||
} | ||
for _, pod := range podList.Items { |
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 have PR that reworks FindOldReplicaSets
- the podList is not needed at all. We should simply look at rs.spec.replicas for filtering RSs with and without pods.
@janetkuo just two comments, reapply lgtm once they are fixed. |
ff6047b
to
990e136
Compare
990e136
to
a850681
Compare
Test failed because #41650 added staging godeps check. Running |
Automatic merge from submit-queue (batch tested with PRs 38957, 41819, 41851, 40667, 41373) |
Removing label |
I just saw https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/41729/pull-kubernetes-bazel/6787/ flake - is this related to the changes made here? |
|
Commit found in the "release-1.5" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
#40415
Release note:
@kubernetes/sig-apps-bugs