Skip to content
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

Merged
merged 6 commits into from
May 20, 2021
Merged

Bug Fix Pod-Template Affinity Ignored due to empty Affinity K8S Object #15787

merged 6 commits into from
May 20, 2021

Conversation

jpyen
Copy link
Contributor

@jpyen jpyen commented May 12, 2021

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.

@boring-cyborg boring-cyborg bot added provider:cncf-kubernetes Kubernetes provider related issues area:providers labels May 12, 2021
@github-actions
Copy link

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
Copy link
Member

@jpyen, can you add test coverage? You can probably just add it to this test:

@jpyen
Copy link
Contributor Author

jpyen commented May 19, 2021

@jedcunningham added test coverage, does that work for you?

@jedcunningham
Copy link
Member

@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.

@github-actions
Copy link

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
Copy link
Contributor Author

jpyen commented May 20, 2021

@jedcunningham all checks passed

@kaxil kaxil merged commit 733bec9 into apache:master May 20, 2021
@kaxil
Copy link
Member

kaxil commented May 20, 2021

Thanks @jpyen and @jedcunningham

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants