-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Fix Pod-Template Affinity Ignored due to empty Affinity K8S Object #15787
Conversation
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
@jpyen, can you add test coverage? You can probably just add it to this test:
|
@jedcunningham added test coverage, does that work for you? |
@jpyen, looks good, thanks. The static checks failed, however. If you haven't already, installing pre-commit hooks can make that easier. Or you can format manually with black. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
@jedcunningham all checks passed |
Thanks @jpyen and @jedcunningham |
Issue:
KubernetesPodOperator pod-template files with pod affinities are ignored, even if no affinities are passed to the KubernetesPodOperator object.
Cause
During the pod-initialization an empty k8s.Affinity object is created if no affinities are supplied. This will later prevent the pod-template affinities to be used, because during the pod_reconciliation the empty k8s.Affinity object takes precedence.
All other attributes such as
self.k8s_resources = convert_resources(resources) if resources else {}
self.image_pull_secrets = convert_image_pull_secrets(image_pull_secrets) if image_pull_secrets else []
handle it properly.