Enable template rendering for env_vars field for the @task.kubernetes decorator#27433
Merged
potiuk merged 7 commits intoapache:mainfrom Nov 11, 2022
fletchjeff:fix-kubernetes-decorator-env-var-template
Merged
Enable template rendering for env_vars field for the @task.kubernetes decorator#27433potiuk merged 7 commits intoapache:mainfrom fletchjeff:fix-kubernetes-decorator-env-var-template
potiuk merged 7 commits intoapache:mainfrom
fletchjeff:fix-kubernetes-decorator-env-var-template
Conversation
raphaelauv
reviewed
Nov 1, 2022
Member
|
You had trailing spaces in your comments. I removed them. |
potiuk
approved these changes
Nov 7, 2022
uranusjr
approved these changes
Nov 7, 2022
uranusjr
reviewed
Nov 7, 2022
dstandish
approved these changes
Nov 8, 2022
dstandish
reviewed
Nov 8, 2022
Adityamalik123
pushed a commit
to Adityamalik123/airflow
that referenced
this pull request
Nov 12, 2022
|
Hi guys, I'm curious to know if there's a method for injecting commands or arguments into a container. It appears that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working through an example of doing XComs with the KubernetesPodOperator, the
env_varsattribute is used to pass templated values into the kubernetes pod. The@task.decoratoruses the_KubernetesDecoratedOperatorclass in this file. It overrides thetemplate_fieldsand excludesenv_varsfrom being rendered.Given that
env_varsseems 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?