flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[BUG] Flytekit duplicates env vars when pod template is specified

Open LucasZanellaMBTI opened this issue 1 year ago • 8 comments

Describe the bug

Containers in pod spec contain duplicate env vars. We can see this problem occur as soon as we define a pod_template and pass it to task decorator.

Expected behavior

Env vars specified and passed via environment param are not being duplicated

Additional context to reproduce

@task(environment={"MY_ENV_VAR": "bug"}, pod_template=PodTemplate())
def hello_world(name: str) -> str:
  pass
pyflyte run --remote hello.py my_wf

Tested on flytekit v1.11.0 & v1.13.7

We spent some time debugging it and it seems problem is caused in func get_serializable_task of flytekit/tools/translator.py. There we see the method get_k8s_pod is called multiple times. Unfortunately, each call appends env vars to every container specified in pod_spec.

Screenshots

image

Lucas Zanella [email protected], Mercedes-Benz Tech Innovation GmbH Provider Information

LucasZanellaMBTI avatar Oct 04 '24 14:10 LucasZanellaMBTI

Thank you for opening your first issue here! 🛠

welcome[bot] avatar Oct 04 '24 14:10 welcome[bot]

Hi @LucasZanellaMBTI, I'd love to work on this issue, could you assign this to me?

ChengyanOo avatar Oct 08 '24 08:10 ChengyanOo

Hi @ChengyanOo , I'm glad to read that. Unfortunately I cannot assign this PR to anyone as I miss required permissions.

LucasZanellaMBTI avatar Oct 08 '24 10:10 LucasZanellaMBTI

Hi @ChengyanOo , I'm glad to read that. Unfortunately I cannot assign this PR to anyone as I miss required permissions.

Thanks for your reply man, do you know who should I contact to figure that out?

ChengyanOo avatar Oct 08 '24 10:10 ChengyanOo

We will try to reach out developers via their slack channel.

LucasZanellaMBTI avatar Oct 08 '24 10:10 LucasZanellaMBTI

We will try to reach out developers via their slack channel.

Thanks!

ChengyanOo avatar Oct 08 '24 10:10 ChengyanOo

"Hello 👋, this issue has been inactive for over 90 days. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! 🙏"

github-actions[bot] avatar May 19 '25 00:05 github-actions[bot]

Hello 👋, this issue has been inactive for over 90 days and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! 🙏

github-actions[bot] avatar May 27 '25 00:05 github-actions[bot]

"Hello 👋, this issue has been inactive for over 90 days. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! 🙏"

github-actions[bot] avatar Aug 27 '25 00:08 github-actions[bot]

Hello 👋, this issue has been inactive for over 90 days and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! 🙏

github-actions[bot] avatar Sep 04 '25 00:09 github-actions[bot]