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

Avoid trying to generate the pod status of a new pod #9549

Merged
merged 1 commit into from Jun 12, 2015

Conversation

bprashanth
Copy link
Contributor

The approach in the first commit is cleaner but won't work if someone runs the kubelet with PodConfigNotificationSnapshots. The second is a little hacky but scopes the application of updateType=create to only new pod workers.

still e2e-ing, and thinking about some edge cases, after which I'll add some tests.
/ref #9429 @dchen1107 @yujuhong

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2015

EXPERIMENTAL JENKINS PR BUILDER: e2e build succeeded.

@bprashanth
Copy link
Contributor Author

Added unittest and this passed e2e, so it should be good for review. Will squash commits before checkin.

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2015

EXPERIMENTAL JENKINS PR BUILDER: e2e build succeeded.

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2015

EXPERIMENTAL JENKINS PR BUILDER: e2e build succeeded.

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2015

EXPERIMENTAL JENKINS PR BUILDER: e2e build succeeded.

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2015

EXPERIMENTAL JENKINS PR BUILDER: e2e build succeeded.

@k8s-bot
Copy link

k8s-bot commented Jun 10, 2015

GCE e2e build/test failed for commit d4bbfe39f6cfc6d02b3de40f125a9517283dbc2e.

@bprashanth
Copy link
Contributor Author

e2e failure is unrelated and fixed with #9647

@gmarek gmarek self-assigned this Jun 11, 2015
@@ -2789,7 +2789,7 @@ func TestCreateMirrorPod(t *testing.T) {
}
pods := []*api.Pod{pod}
kl.podManager.SetPods(pods)
err := kl.syncPod(pod, nil, container.Pod{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Some test for SyncPodCreate could be useful.

@gmarek
Copy link
Contributor

gmarek commented Jun 11, 2015

I don't like using metrics.SyncPodType (i.e. some monitoring type) in "ordinary" production code. If it is needed we should have it as a first class citizen in Kubelet codebase and use this in monitoring, not the other way around.

@bprashanth
Copy link
Contributor Author

Thinking about kubelet restart

if updateType == metrics.SyncPodCreate {
podStatus = pod.Status
glog.V(3).Infof("Not generating pod status for new pod %v", podFullName)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's kill the else, e.g.:

var podStatus api.PodStatus
var err error
if updateType != metrics.SyncPodCreate {
    podStatus, err = kl.generatePodStatus(pod)
    ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted the logging so I kept the else

@bprashanth bprashanth force-pushed the generate_fix branch 3 times, most recently from e10188a to a53a86b Compare June 11, 2015 20:07
@bprashanth
Copy link
Contributor Author

PTAL

@dchen1107 would appreciate if you could also take a quick look

@k8s-bot
Copy link

k8s-bot commented Jun 11, 2015

GCE e2e build/test passed for commit b74ed284e7491672831f5da39d11c7b1f938ead2.

@k8s-bot
Copy link

k8s-bot commented Jun 11, 2015

GCE e2e build/test passed for commit e10188a79067dd2b994a1653184ee5072f03e196.

@k8s-bot
Copy link

k8s-bot commented Jun 11, 2015

GCE e2e build/test passed for commit a53a86b90a17af99061bac9f28411b920c468ac5.

@@ -131,6 +142,7 @@ func (p *podWorkers) UpdatePod(pod *api.Pod, mirrorPod *api.Pod, updateComplete
// the channel is empty, so buffer of size 1 is enough.
podUpdates = make(chan workUpdate, 1)
p.podUpdates[uid] = podUpdates
updateType = SyncPodCreate
Copy link
Member

Choose a reason for hiding this comment

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

More comments here to explain why reset this updateType here to Create?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm assuming that if you created a pod worker you're willing to believe the status in the pod without having generateStatus again, either because it is a brand new pod or the kubelet restarted. I'll add this as a comment.

@dchen1107
Copy link
Member

LGTM except one small nit.

@bprashanth
Copy link
Contributor Author

Comment added, PTAL

@k8s-bot
Copy link

k8s-bot commented Jun 12, 2015

GCE e2e build/test failed for commit 8ad79322f68db825849447cfbb4fe5debbbe7871.

@k8s-bot
Copy link

k8s-bot commented Jun 12, 2015

GCE e2e build/test failed for commit b5ed0e9.

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

gmarek commented Jun 12, 2015

LGTM. We'll need to figure out proper way of handling Kubelet restarts in the future.

jszczepkowski added a commit that referenced this pull request Jun 12, 2015
Avoid trying to generate the pod status of a new pod
@jszczepkowski jszczepkowski merged commit cd32993 into kubernetes:master Jun 12, 2015
@bprashanth bprashanth deleted the generate_fix branch October 26, 2015 00:41
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants