Commit 7bc86d84 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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
parents 9497139c d419efbe
......@@ -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
......
......@@ -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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment