KubernetesPodOperator "env_vars" field is documented to be templated, but it doesn't work #25841
Unanswered
barrywhart
asked this question in
General
Replies: 1 comment 5 replies
-
I thing you misunderstood what "templated" means. You do not have to use string to make templates work. If you look at env_vars type definition, you will not find "string":
What you should provide is list of k8s.V1EnvVar and template names/values in it (those are strings). Would that work for you? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Apache Airflow version
main (development)
What happened
The KubernetesPodOperator
env_vars
field is documented to be templated, but it doesn't work. If I pass a JSON string to the constructor, it throws an exception:What you think should happen instead
If it receives a string, the constructor should convert it to Python (probably using
ast.literal_eval()
).How to reproduce
I've written a test to demonstrate the behavior. It could be added to
kubernetes_tests/test_kubernetes_pod_operator.py
.Operating System
Debian GNU/Linux 11 (bullseye) (I'm running the Breeze dev environment)
Versions of Apache Airflow Providers
I'm using the Breeze development environment with the latest
main
code as of August 19, 2022:Deployment
Other
Deployment details
Breeze development environment
Anything else
The problem happens every time.
I would like to submit a PR to address this issue. I would also like (if it sounds reasonable -- please let me know) to add similar templating support for these other fields:
resources
tolerations
Are you willing to submit PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions