Merge pull request #43116 from dchen1107/master

Automatic merge from submit-queue (batch tested with PRs 42828, 43116)

Apply taint tolerations for NoExecute for all static pods.

Fixed https://github.com/kubernetes/kubernetes/issues/42753


**Release note**:
```
Apply taint tolerations for NoExecute for all static pods.
```

cc/ @davidopp
This commit is contained in:
Kubernetes Submit Queue 2017-03-17 18:14:29 -07:00 committed by GitHub
commit 7bc86d84c1
2 changed files with 13 additions and 0 deletions

View File

@ -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 {
// Applying the default Taint tolerations to static pods,
// so they are not evicted when there are node problems.
api.AddOrUpdateTolerationInPod(pod, &api.Toleration{
Operator: "Exists",
Effect: api.TaintEffectNoExecute,
})
}
// Set the default status to pending.
pod.Status.Phase = api.PodPending
return nil

View File

@ -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",