Apply KubernetesPodOperator template fields only after rendering - #71174
Merged
Merged
Conversation
rjgoyln
force-pushed
the
fix-kpo-template-field-init
branch
from
August 5, 2026 15:47
36f2991 to
0253bf6
Compare
rjgoyln
marked this pull request as ready for review
August 8, 2026 00:15
rjgoyln
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
hussein-awala,
jason810496,
jedcunningham,
jscheffl and
potiuk
as code owners
August 8, 2026 00:15
rjgoyln
force-pushed
the
fix-kpo-template-field-init
branch
from
August 25, 2026 14:16
71f16d1 to
6dde469
Compare
shahar1
requested changes
Sep 12, 2026
Template fields are rendered after the constructor runs, so converting or merging their values there operates on the un-rendered Jinja expression: a templated base_container_name never reached the container_logs fallback, a templated configmaps string was iterated character by character, and templated volumes were rejected at Dag parse time. The one conversion that still has to precede rendering — a str-str env_vars mapping, whose keys are only rendered once they are V1EnvVar names — hooks _do_render_template_fields rather than render_template_fields, because a mapped task reaches the operator only through the former. Clears the KubernetesPodOperator entry of the burn-down tracked at apache#70296.
rjgoyln
force-pushed
the
fix-kpo-template-field-init
branch
from
September 13, 2026 05:41
6dde469 to
b4bf207
Compare
shahar1
approved these changes
Sep 16, 2026
Contributor
|
Great work! |
Contributor
Backport failed to create: v3-3-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 073d1ed v3-3-testThis should apply the commit to the v3-3-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
78 tasks
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.
Summary
KubernetesPodOperatorconverted and merged several template-field values in__init__, which runs before Jinja rendering. A templatedbase_container_namewas copied into the defaultcontainer_logsand never rendered, so log fetching asked for a container that did not exist. A templatedconfigmapsstring was iterated character by character intoenv_from, and templatedvolumes/volume_mountswere rejected at Dag parse time before they could resolve.__init__now only stores these arguments; the conversions run inbuild_pod_request_obj()andcontainer_logsresolves its base-container fallback lazily.configmapsbecomes a declared template field, having previously been rendered by accident through theenv_fromlist it was merged into.An
env_varsmapping is the one conversion that still precedes rendering, in arender_template_fieldsoverride: an env var name is a template field ofV1EnvVar, while a plain dict renders only its values. Only the container shape is inspected, never the value.Behavior change
SparkKubernetesOperatorno longer warns thatcontainer_logs"is not supported and will be overridden" when the user never passed it; an explicitly requested container is still overridden to the driver container.Clears the
KubernetesPodOperatorentry of the burn-down tracked in #70296.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines