Skip to content

Add pod_override setting for KubernetesExecutor - #10756

Merged
dimberman merged 3 commits into
apache:masterfrom
astronomer:pod_override_mode
Sep 8, 2020
Merged

Add pod_override setting for KubernetesExecutor#10756
dimberman merged 3 commits into
apache:masterfrom
astronomer:pod_override_mode

Conversation

@dimberman

Copy link
Copy Markdown
Contributor

Users of the KubernetesExecutor will now have a "podOverride"
option in the executor_config. This option will allow users to
modify the pod launched by the KubernetesExecutor using a
kubernetes.client.models.V1Pod class. This is the first step
in deprecating the tradition executor_config.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@dimberman

Copy link
Copy Markdown
Contributor Author

@potiuk @kaxil @turbaszek can I get a review on this? :)

Comment thread airflow/kubernetes/pod_generator.py Outdated
Comment thread airflow/kubernetes/pod_generator.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
k8s_object = obj.get("podOverride", None)
k8s_object = obj.get("pod_override", None)

I think using snake_case might be better, wdyt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaxil sure, I was trying to keep in line with the original key "KubernetesExecutor", but I'm fine with that to be more consistent with pythonic best practices.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaxil fixed

Comment thread airflow/kubernetes/pod_generator.py Outdated
@mik-laj

mik-laj commented Sep 7, 2020

Copy link
Copy Markdown
Member

Can you add more docs about this feature? Code cleaning is also a good time to fill gaps in the documentation. ;-)
Reference docs is not enougth for beginner. Small guide will be helpfull.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a separate file here? We just want to deprecate but still support KubernetesExecutor config. The code you delete in airflow/kubernetes/pod_generator.py can just go in a separate function or a static method (or just in that if block) in the same file, just prefix it with _

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaxil We need a separate file because in the simplify_kubernetes_executor PR we change a lot more stuff in the pod_generator file and it is safest to just keep it separated. This PR is mostly about simplifying that PR.

@kaxil kaxil Sep 7, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah should I review that first? Can you tell me the dependencies in the PR.

@kaxil kaxil Sep 7, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we should separate the "new module" bit in a different PR because more reviewers might face the same question

@kaxil kaxil changed the title Add podOverride setting for KubernetesExecutor Add pod_override setting for KubernetesExecutor Sep 7, 2020
Comment thread docs/concepts.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concepts.rst should have only the core concepts. Additional information specific to a specific topic should be included in the topic article. For example, queues are unique to CeleryExecutor, so they are described in CeleryExecutor.

Comment thread docs/concepts.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use :class:: role when you refer to class for the first time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks PST to poland time converter

...

@mik-laj when do you sleep?...

Comment thread docs/concepts.rst Outdated

@mik-laj mik-laj Sep 8, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use an literalicnlude or exampleinclude directive to include code snippets? This makes the code easier to maintain as all automatic checks can verify it. Ideally this example is covered by integration/system tests to be sure it is working properly. All guides for Google services are made this way, so you can see it in practice.

Comment thread docs/concepts.rst Outdated
Comment thread docs/concepts.rst Outdated
Comment thread docs/concepts.rst Outdated
Comment thread tests/kubernetes/test_pod_generator.py Outdated
Users of the KubernetesExecutor will now have a "podOverride"
option in the executor_config. This option will allow users to
modify the pod launched by the KubernetesExecutor using a
`kubernetes.client.models.V1Pod` class. This is the first step
in deprecating the tradition executor_config.
@dimberman
dimberman merged commit 20481c3 into apache:master Sep 8, 2020
@dimberman
dimberman deleted the pod_override_mode branch September 8, 2020 22:57
@kaxil kaxil added the provider:cncf-kubernetes Kubernetes (k8s) provider related issues label Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants