EvenPodsSpread: api changes
This commit is contained in:
@@ -401,6 +401,11 @@ func dropDisabledFields(
|
||||
// does not specify any values for these fields.
|
||||
podSpec.PreemptionPolicy = nil
|
||||
}
|
||||
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.EvenPodsSpread) && !topologySpreadConstraintsInUse(oldPodSpec) {
|
||||
// Set TopologySpreadConstraints to nil only if feature is disabled and it is not used
|
||||
podSpec.TopologySpreadConstraints = nil
|
||||
}
|
||||
}
|
||||
|
||||
// dropDisabledRunAsGroupField removes disabled fields from PodSpec related
|
||||
@@ -562,7 +567,14 @@ func overheadInUse(podSpec *api.PodSpec) bool {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// topologySpreadConstraintsInUse returns true if the pod spec is non-nil and has a TopologySpreadConstraints slice
|
||||
func topologySpreadConstraintsInUse(podSpec *api.PodSpec) bool {
|
||||
if podSpec == nil {
|
||||
return false
|
||||
}
|
||||
return len(podSpec.TopologySpreadConstraints) > 0
|
||||
}
|
||||
|
||||
// procMountInUse returns true if the pod spec is non-nil and has a SecurityContext's ProcMount field set to a non-default value
|
||||
|
||||
Reference in New Issue
Block a user