func AddOrUpdateTolerationInPodSpec(spec *v1.PodSpec, toleration *v1.Toleration) bool {
	podTolerations := spec.Tolerations

	var newTolerations []v1.Toleration
	updated := false
	for i := range podTolerations {
		if toleration.MatchToleration(&podTolerations[i]) {
			if helper.Semantic.DeepEqual(toleration, podTolerations[i]) {
				return false
			}
			newTolerations = append(newTolerations, *toleration)
			updated = true
			continue
		}

		newTolerations = append(newTolerations, podTolerations[i])
	}

	if !updated {
		newTolerations = append(newTolerations, *toleration)
	}

	spec.Tolerations = newTolerations
	return true
}
// AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec.
// Returns true if something was updated, false otherwise.
AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec.
Returns true if something was updated, false otherwise.
// AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec . // Returns true if something was updated false otherwise .
func AddOrUpdateTolerationInPodSpec(spec *v1.PodSpec, toleration *v1.Toleration) bool {
	podTolerations := spec.Tolerations
	var newTolerations []v1.Toleration
	updated := false
	for i := range podTolerations {
		if toleration.MatchToleration(&podTolerations[i]) {
			if helper.Semantic.DeepEqual(toleration, podTolerations[i]) {
				return false
			}
			newTolerations = append(newTolerations, *toleration)
			updated = true
			continue
		}
		newTolerations = append(newTolerations, podTolerations[i])
	}
	if !updated {
		newTolerations = append(newTolerations, *toleration)
	}
	spec.Tolerations = newTolerations
	return true
}
func AddOrUpdateTolerationInPodSpec ( spec * v1 . PodSpec , toleration * v1 . Toleration ) bool { podTolerations := spec . Tolerations var newTolerations [ ] v1 . Toleration updated := false for i := range podTolerations { if toleration . MatchToleration ( & podTolerations [ i ] ) { if helper . Semantic . DeepEqual ( toleration , podTolerations [ i ] ) { return false } newTolerations = append ( newTolerations , * toleration ) updated = true continue } newTolerations = append ( newTolerations , podTolerations [ i ] ) } if ! updated { newTolerations = append ( newTolerations , * toleration ) } spec . Tolerations = newTolerations return true }
AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec.
AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec .