mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-26 15:12:06 +00:00
generated client-go.
Kubernetes-commit: 98a52fd6b5fd50f45554c4c8f86350d62826fc26
This commit is contained in:
parent
7f5f33cf4b
commit
1f9cd88972
@ -494,7 +494,7 @@ func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Tolerati
|
|||||||
|
|
||||||
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
|
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
|
||||||
// Returns true if something was updated, false otherwise.
|
// 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
|
podTolerations := pod.Spec.Tolerations
|
||||||
|
|
||||||
var newTolerations []Toleration
|
var newTolerations []Toleration
|
||||||
@ -502,7 +502,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
|
|||||||
for i := range podTolerations {
|
for i := range podTolerations {
|
||||||
if toleration.MatchToleration(&podTolerations[i]) {
|
if toleration.MatchToleration(&podTolerations[i]) {
|
||||||
if Semantic.DeepEqual(toleration, podTolerations[i]) {
|
if Semantic.DeepEqual(toleration, podTolerations[i]) {
|
||||||
return false, nil
|
return false
|
||||||
}
|
}
|
||||||
newTolerations = append(newTolerations, *toleration)
|
newTolerations = append(newTolerations, *toleration)
|
||||||
updated = true
|
updated = true
|
||||||
@ -517,7 +517,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pod.Spec.Tolerations = newTolerations
|
pod.Spec.Tolerations = newTolerations
|
||||||
return true, nil
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
|
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
|
||||||
|
@ -276,9 +276,9 @@ const (
|
|||||||
AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity"
|
AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tries to add a toleration to annotations list. Returns true if something was updated
|
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
|
||||||
// false otherwise.
|
// 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
|
podTolerations := pod.Spec.Tolerations
|
||||||
|
|
||||||
var newTolerations []Toleration
|
var newTolerations []Toleration
|
||||||
@ -286,7 +286,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
|
|||||||
for i := range podTolerations {
|
for i := range podTolerations {
|
||||||
if toleration.MatchToleration(&podTolerations[i]) {
|
if toleration.MatchToleration(&podTolerations[i]) {
|
||||||
if api.Semantic.DeepEqual(toleration, podTolerations[i]) {
|
if api.Semantic.DeepEqual(toleration, podTolerations[i]) {
|
||||||
return false, nil
|
return false
|
||||||
}
|
}
|
||||||
newTolerations = append(newTolerations, *toleration)
|
newTolerations = append(newTolerations, *toleration)
|
||||||
updated = true
|
updated = true
|
||||||
@ -301,7 +301,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pod.Spec.Tolerations = newTolerations
|
pod.Spec.Tolerations = newTolerations
|
||||||
return true, nil
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
|
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
|
||||||
|
Loading…
Reference in New Issue
Block a user