Skip to content
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 updatePod() of RS and RC controllers #27415

Merged
merged 1 commit into from
Jun 17, 2016

Conversation

caesarxuchao
Copy link
Member

Fix updatePod of replication controller manager and replica set controller to handle pod label updates that match no RC or RS.

Fix #27405

@caesarxuchao caesarxuchao added this to the v1.3 milestone Jun 15, 2016
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Jun 15, 2016
@bprashanth bprashanth added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Jun 15, 2016
if rs == nil {
return
}

if curPod.DeletionTimestamp != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If deletion timestamp is set on the cur pod and old pod has a different rc (i.e we got a single update with deletion timestamp and label change -- this can happen if both updates hit during a relist), we should invoke deletePod with the old one too. It's safe to do this becase deletion timestamp can never be unset.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this sounds good. I've updated the code.

@bprashanth bprashanth removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 15, 2016
if curPod.DeletionTimestamp != nil {
// when a pod is deleted gracefully it's deletion timestamp is first modified to reflect a grace period,
// and after such time has passed, the kubelet actually deletes it from the store. We receive an update
// for modification of the deletion timestamp and expect an rs to create more replicas asap, not wait
// until the kubelet actually deletes the pod. This is different from the Phase of a pod changing, because
// an rs never initiates a phase change, and so is never asleep waiting for the same.
rsc.deletePod(curPod)
if !reflect.DeepEqual(curPod.Labels, oldPod.Labels) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added these lines to address the comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please extract the deepequal into a local var with a name like labelsChanged since we're doing it twice, and add a comment about why it's safe to just invoke deletePod with the oldPod without checking delete timestamp (i.e we can never have a curPod without timestmap and oldPod with).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

oldPod := old.(*api.Pod)

glog.V(6).Infof("Pod %s updated, objectMeta %+v -> %+v.", curPod.Name, oldPod.ObjectMeta, curPod.ObjectMeta)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V(6) is useless IMO, we need V(4) for it to show up in test logs. I think V(4) objectmeta is fine, the really verbose part are container statuses.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

…oller to

handle pod label updates that match no rc or rs
@bprashanth
Copy link
Contributor

Thanks, LGTM

@bprashanth bprashanth added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 15, 2016
@bprashanth
Copy link
Contributor

Both your failures are #27451 but I don't think triggering a rerun ensures that we won't hit it

@goltermann goltermann added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Jun 15, 2016
@goltermann
Copy link
Contributor

+priority/P0 label, this fixes an issue labeled P0

@caesarxuchao
Copy link
Member Author

@k8s-bot e2e test this, issue #27451

@caesarxuchao
Copy link
Member Author

@k8s-bot node e2e test this, issue #27451

@k8s-bot
Copy link

k8s-bot commented Jun 16, 2016

GCE e2e build/test passed for commit 63fb075.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jun 17, 2016

GCE e2e build/test passed for commit 63fb075.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 646a872 into kubernetes:master Jun 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants