mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
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:
commit
7bc86d84c1
@ -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.
|
// The generated UID is the hash of the file.
|
||||||
pod.Annotations[kubetypes.ConfigHashAnnotationKey] = string(pod.UID)
|
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.
|
// Set the default status to pending.
|
||||||
pod.Status.Phase = api.PodPending
|
pod.Status.Phase = api.PodPending
|
||||||
return nil
|
return nil
|
||||||
|
@ -208,6 +208,10 @@ func getTestCases(hostname types.NodeName) []*testCase {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
DNSPolicy: v1.DNSClusterFirst,
|
DNSPolicy: v1.DNSClusterFirst,
|
||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
|
Tolerations: []v1.Toleration{{
|
||||||
|
Operator: "Exists",
|
||||||
|
Effect: "NoExecute",
|
||||||
|
}},
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
Name: "image",
|
Name: "image",
|
||||||
Image: "test/image",
|
Image: "test/image",
|
||||||
|
Loading…
Reference in New Issue
Block a user