-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AIRFLOW-6290] Create guide for GKE operators #8883
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
[AIRFLOW-6290] Create guide for GKE operators #8883
Conversation
* `GKE API Documentation <https://cloud.google.com/kubernetes-engine/docs/reference/rest>`__ | ||
* `Product Documentation <https://cloud.google.com/kubernetes-engine/docs/>`__ | ||
* `Kubernetes Documentation <https://kubernetes.io/docs/home/>`__ | ||
* `Kubernetes Documentation <https://kubernetes.io/docs/home/>`__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `Kubernetes Documentation <https://kubernetes.io/docs/home/>`__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
.. _howto/operator:GKEStartPodOperator: | ||
|
||
Run a Pod on a GKE cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add link to this guide?
https://airflow.readthedocs.io/en/latest/howto/operator/kubernetes.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this is a duplicate of this
Specified guide as part of addressing that comment so considering this done.
To run a Kubernetes Pod on a GKE cluster, use | ||
:class:`~airflow.providers.google.cloud.operators.kubernetes_engine.GKEStartPodOperator`. | ||
It is worth noting that this extends | ||
:class:`~airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator` | ||
so many of the same arguments can be used. We can enable the usage of :ref:`XCom <concepts:xcom>` | ||
on the operator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To run a Kubernetes Pod on a GKE cluster, use | |
:class:`~airflow.providers.google.cloud.operators.kubernetes_engine.GKEStartPodOperator`. | |
It is worth noting that this extends | |
:class:`~airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator` | |
so many of the same arguments can be used. We can enable the usage of :ref:`XCom <concepts:xcom>` | |
on the operator: | |
You can use two operators to run pod on a GKE cluster: | |
* :class:`~airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator` | |
* :class:`~airflow.providers.google.cloud.operators.kubernetes_engine.GKEStartPodOperator` | |
``GKEPodOperator`` extends ``KubernetesPodOperator`` to provide authorization using a Google credentials. This way you don't have to manage the `kube_config` file, but it will be generated automatically. All Kubernetes (except `config_file`) parameters are also valid for GKEStartPodOperator. | |
For more information about starting pods on Airflow, please look at: :ref:`howto/operator:KubernetesPodOperator` guide. | |
We can enable the usage of :ref:`XCom <concepts:xcom>` on the operator: |
WDYT? I would like to show a clear difference between these two operators, because it can be embarrassing. GKEPodOperator is not magic operaotr. It's only wrapper.
This is especially important for me because this information is not in the Cloud Composer documentation, and I often redirect users to this documentation if they want to use KubernetesPodOperator
https://cloud.google.com/composer/docs/how-to/using/using-kubernetes-pod-operator
This guide is in the Cloud Composer documentation but applies to all users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
Google Kubernetes Engine Operators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add link to this guide in the Kubernetes Pod Operator guide?
https://airflow.readthedocs.io/en/latest/howto/operator/kubernetes.html
.. note::
If you use `Google Kubernetes Engine <https://cloud.google.com/kubernetes-engine/>`__, use
:ref:`GKEStartPodOperator <howto/operator:GKEStartPodOperator>`__ operaator, which
simplifies the authorization process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so many of the same arguments can be used. We can enable the usage of :ref:`XCom <concepts:xcom>` | ||
on the operator: | ||
|
||
.. exampleinclude:: ../../../../airflow/providers/google/cloud/example_dags/example_kubernetes_engine.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write a long description about data transfer via xcom? I am missing information about the /airflow/xcom/return.json file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…te-guide-for-gke-operators
…te-guide-for-gke-operators
025aa4c
to
9b7ceb8
Compare
@tanjinP It looks good. Should I merge it? |
@mik-laj - I'm good for the merge, thanks for checking in! |
@tanjinP Static checks are sad. Can you fix it? |
Github Action are sad. Can you fix it? |
1526ead
to
7f26469
Compare
All checks are happy again. Sorry for the strange number of commits, it looks like I screwed up with the rebasing. However I don't think it matters for now as long as we squash them into |
Awesome work, congrats on your first merged pull request! |
Thanks for the great contributions. What is your next step? |
Thank you for the help! There are still a few other issues/PRs I'm working through so I will continue working on them. |
Closes AIRFLOW-6290 / issue #8206 .
Contains a guide that is appropriately linked to on how to use the various operators in GKE Service.
Make sure to mark the boxes below before creating PR: [x]
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.
Read the Pull Request Guidelines for more information.