Skip to content

Commit

Permalink
Merge pull request #209 from decayofmind/affinity-empty-struct-fix
Browse files Browse the repository at this point in the history
Default Pod Selector ignores Pods with affinity set to empty struct
  • Loading branch information
Jacobious52 authored Mar 2, 2022
2 parents a0f94e6 + 9585668 commit ac5f8de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/controller/node_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ func NewPodDefaultFilterFunc() k8s.PodFilterFunc {
// Only include pods that pass the following:
// - Don't have a nodeSelector
// - Don't have an affinity
return len(pod.Spec.NodeSelector) == 0 && pod.Spec.Affinity == nil
return len(pod.Spec.NodeSelector) == 0 && (pod.Spec.Affinity == nil ||
(pod.Spec.Affinity.NodeAffinity == nil && pod.Spec.Affinity.PodAffinity == nil &&
pod.Spec.Affinity.PodAntiAffinity == nil))
}
}

Expand Down

0 comments on commit ac5f8de

Please sign in to comment.