Is your feature request related to a problem? Please describe.
RemovePodsViolatingInterPodAntiAffinity only acts on requiredDuringSchedulingIgnoredDuringExecution. Preferred rules are silently ignored — the helper that pulls anti-affinity terms only reads the
required slice:
https://github.com/kubernetes-sigs/descheduler/blob/v0.35.1/pkg/utils/predicates.go#L344
In practice this means a Deployment with preferred pod anti-affinity (very common — services that want to spread across nodes for HA without risking unschedulable pods) can have all replicas land on one
node, and the descheduler will never rebalance them. We hit this on a real cluster: two replicas co-located on a Spot node, a clear preferred-rule violation, zero evictions over 9 days of dry-run.
Describe the solution you'd like
Same pattern that RemovePodsViolatingTopologySpreadConstraint already uses: an opt-in plugin arg. Roughly:
- name: RemovePodsViolatingInterPodAntiAffinity
args:
includeSoftConstraints: true # default false — preserves current behavior
When true, GetPodAntiAffinityTerms would also return PreferredDuringSchedulingIgnoredDuringExecution terms.
Describe alternatives you've considered
Switched to topologySpreadConstraints with whenUnsatisfiable: ScheduleAnyway and the topology-spread plugin configured for [DoNotSchedule, ScheduleAnyway]. That works for our case, but topology spread isn't
a 1:1 substitute for anti-affinity in every scenario, and it's surprising that the two plugins behave so differently for soft constraints.
What version of descheduler are you using?
descheduler version: v0.35.1
Additional context
Happy to send a PR
Is your feature request related to a problem? Please describe.
RemovePodsViolatingInterPodAntiAffinityonly acts onrequiredDuringSchedulingIgnoredDuringExecution. Preferred rules are silently ignored — the helper that pulls anti-affinity terms only reads therequired slice:
https://github.com/kubernetes-sigs/descheduler/blob/v0.35.1/pkg/utils/predicates.go#L344
In practice this means a Deployment with preferred pod anti-affinity (very common — services that want to spread across nodes for HA without risking unschedulable pods) can have all replicas land on one
node, and the descheduler will never rebalance them. We hit this on a real cluster: two replicas co-located on a Spot node, a clear preferred-rule violation, zero evictions over 9 days of dry-run.
Describe the solution you'd like
Same pattern that
RemovePodsViolatingTopologySpreadConstraintalready uses: an opt-in plugin arg. Roughly:When true, GetPodAntiAffinityTerms would also return PreferredDuringSchedulingIgnoredDuringExecution terms.
Describe alternatives you've considered
Switched to topologySpreadConstraints with whenUnsatisfiable: ScheduleAnyway and the topology-spread plugin configured for [DoNotSchedule, ScheduleAnyway]. That works for our case, but topology spread isn't
a 1:1 substitute for anti-affinity in every scenario, and it's surprising that the two plugins behave so differently for soft constraints.
What version of descheduler are you using?
descheduler version: v0.35.1
Additional context
Happy to send a PR