Skip to content

Commit ac5f8de

Browse files
authoredMar 2, 2022
Merge pull request #209 from decayofmind/affinity-empty-struct-fix
Default Pod Selector ignores Pods with affinity set to empty struct
2 parents a0f94e6 + 9585668 commit ac5f8de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎pkg/controller/node_group.go

+3-1
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)
Failed to load comments.