Skip to content

Add KubernetesPodOperator's name in templated fields #43480

@anteverse

Description

@anteverse

Description

Unless it's been kept out templated fields on purpose, I would like to add the param name of KubernetesPodOperator into template_fields.

My guess is that we wished to protect the pod name and guarantee the right syntax via KubernetesPodOperator._set_name. But I think we could have the best of both worlds by adding name to template_fields and have the protected name through something like self.pod_name = self._set_pod_name(name), or equivalent.

Would that be worth a shot? I'm willing to submit a short PR about this.

Thanks a lot!

Use case/motivation

The current use-case is when we explore pods from the Kubernetes side, it's easy to have pod_name=task_id but that's not sufficient when we have several DAGs with identical tasks in them.
Discriminant and dynamic information can be passed to labels or annotations since they're templated fields, but the pod name isn't.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions