KubernetesPodOperator dry_run failure #45812
Labels
area:providers
good first issue
kind:bug
This is a clearly a bug
provider:cncf-kubernetes
Kubernetes provider related issues
Apache Airflow Provider(s)
cncf-kubernetes
Versions of Apache Airflow Providers
apache-airflow-providers-cncf-kubernetes 4.3.0
Apache Airflow version
2.3.4
Operating System
Linux
Deployment
Official Apache Airflow Helm Chart
Deployment details
n/a
What happened
We are upgrading from apache-airflow-providers-cncf-kubernetes 3.0.0 to 4.3.0 (going slowly through releases).
We have a custom script, that during docker image build of our airflow, tests all dags and all dag tasks in dry_run mode. Mostly to detect Python syntax errors, dag cycles duplicate tasks, wrong imports, ntemplating errors etc.
This was working all fine with our existing airflow, but we decided to upgrade airflow to newer version, and that also means updating airflow providers. After fixing bunch of other issues, I found the issues with KubernetedPodOperator dry run.
New dry_run added in d56ff76 invokes
KubernetesPodOperator
build_pod_request_obj()
method which has a call to a propertyself.hook.is_in_cluster
:Unfortunately this property constructs a Kube API client object which requires kube client config / credentials to work.
This causes dry_run to not able to execute in isolated test environment:
We would like to continue using dry_run, but be able to run it without providing credentials or kube config. It does not need to be 100% accurate.
Two options:
airflow_kpo_in_cluster
label in dry run mode, if user requests to do so.build_pod_request_obj
to havedry_run: bool = False
kwarg and invoke it withdry_run=True
in KubernetesPodOperator.dry_run()` method.(or both)
What you think should happen instead
n/a
How to reproduce
n/a
Anything else
n/a
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: