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

Add Examples and documentation for pod_template_file feature #10916

Merged
merged 15 commits into from
Sep 14, 2020

Conversation

dimberman
Copy link
Contributor

@dimberman dimberman commented Sep 13, 2020

Add more documentation on creating and modifying a pod_template_file for users of the KubernetesExecutor


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

@boring-cyborg boring-cyborg bot added the area:helm-chart Airflow Helm Chart label Sep 13, 2020
@dimberman dimberman changed the title add example dag_templates Add Examples and documentation for pod_template_file feature Sep 13, 2020
@dimberman dimberman force-pushed the pod_template_file_examples branch 3 times, most recently from 042ba02 to 32a5054 Compare September 13, 2020 23:49
@mik-laj mik-laj linked an issue Sep 14, 2020 that may be closed by this pull request
pod_template_file
#################

As of Airflow 1.10.12, users can now use a pod_template_file setting in their airflow.cfg to form the basis of
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
As of Airflow 1.10.12, users can now use a pod_template_file setting in their airflow.cfg to form the basis of
As of Airflow 1.10.12, users can now use a ``pod_template_file`` option in ``XXX`` section in their airflow.cfg to form the basis of

their KubernetesExecutor pods. This process is faster and easier to modify.

We include multiple examples of working pod operators below, but we would also like to explain a few necessary components
if you want to customize your pod_template_files. As long as you have these components, every other element
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if you want to customize your pod_template_files. As long as you have these components, every other element
if you want to customize your Pod template files. As long as you have these components, every other element


Airflow uses the ``pod_template_file`` by making certain assumptions about the structure of the template.
When airflow creates the worker pod's command, it assumes that the airflow worker container part exists
at the beginning of the container array. It then assumes that the container is named "base"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
at the beginning of the container array. It then assumes that the container is named "base"
at the beginning of the container array. It then assumes that the container is named ``"base"``

It's important to note while Airflow overwrites these fields, they **can not be left blank**.
If these fields do not exist, kubernetes can not load the yaml into a Kuberentes V1Pod

2. Each airflow ``pod_template_file`` must have a container named ``base`` at the ``pod.spec.containers[0]`` position
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
2. Each airflow ``pod_template_file`` must have a container named ``base`` at the ``pod.spec.containers[0]`` position
2. Each airflow ``pod_template_file`` must have a container named ``"base"`` at the ``pod.spec.containers[0]`` position

Airflow uses the ``pod_template_file`` by making certain assumptions about the structure of the template.
When airflow creates the worker pod's command, it assumes that the airflow worker container part exists
at the beginning of the container array. It then assumes that the container is named "base"
when it merges this pod with internal configs. Users are more than welcome to create
Copy link
Member

@mik-laj mik-laj Sep 14, 2020

Choose a reason for hiding this comment

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

Suggested change
when it merges this pod with internal configs. Users are more than welcome to create
when it merges this pod with internal configs. You are more than welcome to create

See:
https://developers.google.com/style/person
and

Address the reader directly. Use you, instead of the user or they. For more information, see Second person and first person.

https://developers.google.com/style/translation

docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
dimberman and others added 2 commits September 14, 2020 06:59
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
dimberman and others added 2 commits September 14, 2020 07:00
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
docs/executor/kubernetes.rst Outdated Show resolved Hide resolved
dimberman and others added 3 commits September 14, 2020 07:01
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
@kaxil
Copy link
Member

kaxil commented Sep 14, 2020

hmm tests are failing

@kaxil
Copy link
Member

kaxil commented Sep 14, 2020


/opt/airflow/docs/executor/kubernetes.rst:81:start-after pattern not found: [START template_with_dags_in_image]

@dimberman
Copy link
Contributor Author

@kaxil forgot an s :)

Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

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

Needs updating PR description. The current one says it is cherry-picked from a commit that does not belong to this repo

@dimberman
Copy link
Contributor Author

@kaxil fixed

@dimberman dimberman merged commit d24b8f6 into apache:master Sep 14, 2020
@dimberman dimberman deleted the pod_template_file_examples branch September 14, 2020 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:helm-chart Airflow Helm Chart
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KubernetesExecutor doc: missing docs for pod_template_file
3 participants