atlassian / escalator

Escalator is a batch or job optimized horizontal autoscaler for Kubernetes
Apache License 2.0
646 stars 58 forks source link

Default Pod Selector ignores Pods with affinity set to empty struct #207

Closed decayofmind closed 2 years ago

decayofmind commented 2 years ago

Some solutions such as Gitlab Runner (https://gitlab.com/gitlab-org/gitlab-runner/-/blob/main/common/config.go#L1093) if affinity is not especially set via configs will produce Pods with affinity: {}.

In this case expression pod.Spec.Affinity == nil is not valid, and Affinity is equal to &Affinity{NodeAffinity:nil,PodAffinity:nil,PodAntiAffinity:nil,}.

Affinity is still not set, so condition for Default Pod Selector is still met, however escalator will ignore such pods.

My PR extends NewPodDefaultFilterFunc() fixing this.

atlassian-cla-bot[bot] commented 2 years ago

Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution. If your email is listed below, please ensure that you sign the CLA with the same email address.
The following users still need to sign our CLA:
❌roman.komkov@workday.com

Already signed the CLA? To re-check, try refreshing the page.