mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
Merge pull request #42964 from k82cn/update_defalt_toleration_sec
Automatic merge from submit-queue (batch tested with PRs 44084, 42964) Updated AddOrUpdateTolerationInPod to return bool only. Updated AddOrUpdateTolerationInPod to return bool only, as there's no case to generate error (the error was used for annotation, it'll not return error after moving to field); and also update admission & daemonset accordingly.
This commit is contained in:
@@ -97,29 +97,21 @@ func (p *plugin) Admit(attributes admission.Attributes) (err error) {
|
||||
}
|
||||
|
||||
if !toleratesNodeNotReady {
|
||||
_, err := api.AddOrUpdateTolerationInPod(pod, &api.Toleration{
|
||||
api.AddOrUpdateTolerationInPod(pod, &api.Toleration{
|
||||
Key: metav1.TaintNodeNotReady,
|
||||
Operator: api.TolerationOpExists,
|
||||
Effect: api.TaintEffectNoExecute,
|
||||
TolerationSeconds: defaultNotReadyTolerationSeconds,
|
||||
})
|
||||
if err != nil {
|
||||
return admission.NewForbidden(attributes,
|
||||
fmt.Errorf("failed to add default tolerations for taints `notReady:NoExecute` and `unreachable:NoExecute`, err: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
if !toleratesNodeUnreachable {
|
||||
_, err := api.AddOrUpdateTolerationInPod(pod, &api.Toleration{
|
||||
api.AddOrUpdateTolerationInPod(pod, &api.Toleration{
|
||||
Key: metav1.TaintNodeUnreachable,
|
||||
Operator: api.TolerationOpExists,
|
||||
Effect: api.TaintEffectNoExecute,
|
||||
TolerationSeconds: defaultUnreachableTolerationSeconds,
|
||||
})
|
||||
if err != nil {
|
||||
return admission.NewForbidden(attributes,
|
||||
fmt.Errorf("failed to add default tolerations for taints `notReady:NoExecute` and `unreachable:NoExecute`, err: %v", err))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user