Merge pull request #123481 from sanposhiho/mindomain-stable

graduate MinDomainsInPodTopologySpread to stable
This commit is contained in:
Kubernetes Prow Robot
2024-03-04 17:18:53 -08:00
committed by GitHub
18 changed files with 108 additions and 280 deletions

View File

@@ -559,7 +559,6 @@ func dropDisabledFields(
dropDisabledProcMountField(podSpec, oldPodSpec)
dropDisabledTopologySpreadConstraintsFields(podSpec, oldPodSpec)
dropDisabledNodeInclusionPolicyFields(podSpec, oldPodSpec)
dropDisabledMatchLabelKeysFieldInTopologySpread(podSpec, oldPodSpec)
dropDisabledMatchLabelKeysFieldInPodAffinity(podSpec, oldPodSpec)
@@ -737,33 +736,6 @@ func dropEphemeralResourceClaimRequests(containers []api.EphemeralContainer) {
}
}
// dropDisabledTopologySpreadConstraintsFields removes disabled fields from PodSpec related
// to TopologySpreadConstraints only if it is not already used by the old spec.
func dropDisabledTopologySpreadConstraintsFields(podSpec, oldPodSpec *api.PodSpec) {
if !utilfeature.DefaultFeatureGate.Enabled(features.MinDomainsInPodTopologySpread) &&
!minDomainsInUse(oldPodSpec) &&
podSpec != nil {
for i := range podSpec.TopologySpreadConstraints {
podSpec.TopologySpreadConstraints[i].MinDomains = nil
}
}
}
// minDomainsInUse returns true if the pod spec is non-nil
// and has non-nil MinDomains field in TopologySpreadConstraints.
func minDomainsInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {
return false
}
for _, c := range podSpec.TopologySpreadConstraints {
if c.MinDomains != nil {
return true
}
}
return false
}
// dropDisabledProcMountField removes disabled fields from PodSpec related
// to ProcMount only if it is not already used by the old spec
func dropDisabledProcMountField(podSpec, oldPodSpec *api.PodSpec) {