Skip to content

Commit 9585668

Browse files
committed
Fix filter for affinity set to empty struct
1 parent a0f94e6 commit 9585668

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/controller/node_group.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ func NewPodDefaultFilterFunc() k8s.PodFilterFunc {
268268
// Only include pods that pass the following:
269269
// - Don't have a nodeSelector
270270
// - Don't have an affinity
271-
return len(pod.Spec.NodeSelector) == 0 && pod.Spec.Affinity == nil
271+
return len(pod.Spec.NodeSelector) == 0 && (pod.Spec.Affinity == nil ||
272+
(pod.Spec.Affinity.NodeAffinity == nil && pod.Spec.Affinity.PodAffinity == nil &&
273+
pod.Spec.Affinity.PodAntiAffinity == nil))
272274
}
273275
}
274276

0 commit comments

Comments
 (0)