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

Apply taint tolerations for NoExecute for all static pods. #43116

Merged
merged 2 commits into from
Mar 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/kubelet/config/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName types.Node
// The generated UID is the hash of the file.
pod.Annotations[kubetypes.ConfigHashAnnotationKey] = string(pod.UID)

if isFile {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we want to add this for the http source as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a cautious decision not introducing this to http source. Honestly, I don't know the use case of http-based pods, and it is arguable that they have their own controller outside the node.

// Applying the default Taint tolerations to static pods,
// so they are not evicted when there are node problems.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little bit unsure about this -- does this mean that we'll need to expand the list whenever new taints are added?

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Probably the better thing to do here is

&api.Toleration{
   Operator: "Exists",
   Effect: api.TaintEffectNoExecute,
})

This will tolerate all NoExecute taints that are added in the future, which is presumably what we want for static pods.

I'm going to remove LGTM so @dchen1107 can make this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about this, but still choose to make a cautious decision to hardcoded all NoExecute taints. But I think you guys are right on this.

api.AddOrUpdateTolerationInPod(pod, &api.Toleration{
Operator: "Exists",
Effect: api.TaintEffectNoExecute,
})
}

// Set the default status to pending.
pod.Status.Phase = api.PodPending
return nil
Expand Down
4 changes: 4 additions & 0 deletions pkg/kubelet/config/file_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ func getTestCases(hostname types.NodeName) []*testCase {
RestartPolicy: v1.RestartPolicyAlways,
DNSPolicy: v1.DNSClusterFirst,
TerminationGracePeriodSeconds: &grace,
Tolerations: []v1.Toleration{{
Operator: "Exists",
Effect: "NoExecute",
}},
Containers: []v1.Container{{
Name: "image",
Image: "test/image",
Expand Down