Takes a deployment in your kubernetes cluster and turns its pod template into a KubernetesPodOperator object.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file airkupofrod-0.7.0.tar.gz
.
File metadata
- Download URL: airkupofrod-0.7.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7511d46871a90b4fd2a07d9807fc6a57c196f636431ed0c4a8192417a47a5edf |
|
MD5 | 222ed6975afaac448f34eabd082b03d1 |
|
BLAKE2b-256 | 76e927537b486d6fecb4dfd1de399cbca79cdd8f061514026713b93aaf7fe359 |
File details
Details for the file airkupofrod-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: airkupofrod-0.7.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0625ea0c43bf0a3fb1ca2b8bdd60820311df326958ba1001389bc8ba161f0af5 |
|
MD5 | d880fbcf0d5327ea4812ac6673fba76a |
|
BLAKE2b-256 | 52437010651b3d0d7dda29f29484c11b802fee5eeba14c6f0edc0fabc917b7d6 |