Skip to content

Commit

Permalink
Fix filter for affinity set to empty struct
Browse files Browse the repository at this point in the history
  • Loading branch information
decayofmind committed Feb 28, 2022
1 parent a0f94e6 commit 9585668
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 9585668

Please sign in to comment.