Airflow KubernetesPodOperatorFromDeployment
Or airkupofrod for short, is a tiny package which does one thing - takes a deployment in your kubernetes cluster and
turns allows you to use its pod template as a KubernetesPodOperator object. It does this by providing the
KubernetesPodOperatorFromDeployment operator.
airkupofrod supports 1.10.9<=airflow<2
Installation and usage
Ensure your airflow image has the python package airkupofrod installed
pip install airkupofrod
Then in your dags:
from airkupofrod.operator import KubernetesPodOperatorFromDeployment
my_kupofrod_task = KubernetesPodOperatorFromDeployment(
deployment_labels={"app": "my-app"}, # deployment labels to lookup by
deployment_fields={"metadata.name": "my-app-deploy-template"}, # deployment fields to lookup by
deployment_namespace="some-ns", # where the deployment lives
namespace="default", # where the pod will be deployed
task_id="my-kupofrod-task",
dag=dag,
in_cluster=True,
)
You will also need to make sure that a service account attached to your airflow pods has the a role capable of listing deployments bound to it. See role-binding for an example of this.
This is in addition to the role bindings necessary for the KubernetesPodOperator to work which can be seen in the
airflow helm chart
Developing
Skaffold is used to test and develop inside kubernetes.
After ensuring you have:
- Skaffold
- Helm
- Some type of k8s cluster available
Run:
skaffold dev --force=false --cleanup=false --status-check=false --port-forward
Then navigate to http://localhost:8080 and enable and trigger a run of the test deployments dag.
Release files for airkupofrod 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| airkupofrod-0.7.0.tar.gz | 25.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| airkupofrod-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.4 kB
Release files / airkupofrod-0.7.0.tar.gz
| Download URL | airkupofrod-0.7.0.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7511d46871a90b4fd2a07d9807fc6a57c196f636431ed0c4a8192417a47a5edf
|
|
BLAKE2b-256 checksum How to use checksums |
76e927537b486d6fecb4dfd1de399cbca79cdd8f061514026713b93aaf7fe359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.12
|
Release files / airkupofrod-0.7.0-py3-none-any.whl
| Download URL | airkupofrod-0.7.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0625ea0c43bf0a3fb1ca2b8bdd60820311df326958ba1001389bc8ba161f0af5
|
|
BLAKE2b-256 checksum How to use checksums |
52437010651b3d0d7dda29f29484c11b802fee5eeba14c6f0edc0fabc917b7d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.12
|