Skip to content

Conversation

@fletchjeff
Copy link
Contributor

While working through an example of doing XComs with the KubernetesPodOperator, the env_vars attribute is used to pass templated values into the kubernetes pod. The @task.decorator uses the _KubernetesDecoratedOperator class in this file. It overrides the template_fields and excludes env_vars from being rendered.

Given that env_vars seems to be the standard approach passing XComs into a kubernetes pod, I think this should be enabled. Its a quite a simple change.

This line https://github.com/fletchjeff/airflow/blob/main/airflow/providers/cncf/kubernetes/decorators/kubernetes.py#L60

goes from:

template_fields: Sequence[str] = ("op_args", "op_kwargs",)

to:

template_fields: Sequence[str] = ("op_args", "op_kwargs", "env_vars")

No other changes are made.

@uranusjr @dstandish Please can you review?

@potiuk
Copy link
Member

potiuk commented Nov 7, 2022

You had trailing spaces in your comments. I removed them.

@potiuk potiuk merged commit 52593b0 into apache:main Nov 11, 2022
Adityamalik123 pushed a commit to Adityamalik123/airflow that referenced this pull request Nov 12, 2022
@bozzlab
Copy link

bozzlab commented Nov 28, 2023

Hi guys,

I'm curious to know if there's a method for injecting commands or arguments into a container. It appears that task.kubernetes doesn't support this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants