1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 21:31:18 +01:00

removepodsviolatingtopologyspreadconstraint: implement explicit constraints

This commit is contained in:
Amir Alavi
2023-06-03 18:58:18 -04:00
parent 5f0edb5f93
commit 7f2f6f2b16
14 changed files with 254 additions and 27 deletions

View File

@@ -14,6 +14,7 @@ limitations under the License.
package removepodsviolatingtopologyspreadconstraint
import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
utilpointer "k8s.io/utils/pointer"
)
@@ -32,10 +33,10 @@ func SetDefaults_RemovePodsViolatingTopologySpreadConstraintArgs(obj runtime.Obj
if args.LabelSelector == nil {
args.LabelSelector = nil
}
if !args.IncludeSoftConstraints {
args.IncludeSoftConstraints = false
}
if args.TopologyBalanceNodeFit == nil {
args.TopologyBalanceNodeFit = utilpointer.Bool(true)
}
if len(args.Constraints) == 0 {
args.Constraints = append(args.Constraints, v1.DoNotSchedule)
}
}