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:
@@ -494,7 +494,7 @@ func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Tolerati
|
||||
|
||||
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
|
||||
// Returns true if something was updated, false otherwise.
|
||||
func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error) {
|
||||
func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) bool {
|
||||
podTolerations := pod.Spec.Tolerations
|
||||
|
||||
var newTolerations []Toleration
|
||||
@@ -502,7 +502,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
|
||||
for i := range podTolerations {
|
||||
if toleration.MatchToleration(&podTolerations[i]) {
|
||||
if Semantic.DeepEqual(toleration, podTolerations[i]) {
|
||||
return false, nil
|
||||
return false
|
||||
}
|
||||
newTolerations = append(newTolerations, *toleration)
|
||||
updated = true
|
||||
@@ -517,7 +517,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
|
||||
}
|
||||
|
||||
pod.Spec.Tolerations = newTolerations
|
||||
return true, nil
|
||||
return true
|
||||
}
|
||||
|
||||
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
|
||||
|
Reference in New Issue
Block a user