Skip to content

Apply KubernetesPodOperator template fields only after rendering - #71174

Draft
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix-kpo-template-field-init
Draft

Apply KubernetesPodOperator template fields only after rendering#71174
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix-kpo-template-field-init

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

KubernetesPodOperator converted and merged several template-field values in __init__, which runs before Jinja rendering. A templated base_container_name was copied into the default container_logs and never rendered, so log fetching asked for a container that did not exist. A templated configmaps string was iterated character by character into env_from, and templated volumes / volume_mounts were rejected at Dag parse time before they could resolve.

__init__ now only stores these arguments; the conversions run in build_pod_request_obj() and container_logs resolves its base-container fallback lazily. configmaps becomes a declared template field, having previously been rendered by accident through the env_from list it was merged into.

An env_vars mapping is the one conversion that still precedes rendering, in a render_template_fields override: an env var name is a template field of V1EnvVar, while a plain dict renders only its values. Only the container shape is inspected, never the value.

Behavior change

SparkKubernetesOperator no longer warns that container_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 KubernetesPodOperator entry of the burn-down tracked in #70296.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

@boring-cyborg boring-cyborg Bot added area:dev-tools area:providers backport-to-v3-3-test Backport to v3-3-test provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Aug 5, 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.

Clears the KubernetesPodOperator entry of the burn-down tracked at
apache#70296.
@rjgoyln
rjgoyln force-pushed the fix-kpo-template-field-init branch from 36f2991 to 0253bf6 Compare August 5, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:providers backport-to-v3-3-test Backport to v3-3-test provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant