<#5809 [BUG] Flytekit duplicates env vars when pod...
# flyte-github
c
#5809 [BUG] Flytekit duplicates env vars when pod template is specified Issue created by LucasZanellaMBTI # 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](https://private-user-images.githubusercontent.com/155651901/373677700-4589657d-6317-4544-87bc-014745894f5e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDgzOTEyODMsIm5iZiI6MTc0ODM5MDk4MywicGF0aCI6Ii8xNTU2NTE5MDEvMzczNjc3NzAwLTQ1ODk2NTdkLTYzMTctNDU0NC04N2JjLTAxNDc0NTg5NGY1ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNTI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDUyOFQwMDA5NDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01OTliYmUyOWNiOWRlMDc1YTFkMDU5NTg2NWNhZjQxNGM1YjVkZjY2M2VjNGVhN2FkMDcwNzc5ZGFhM2JhZDY2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.cFcm6P07n5kp101VYsQZshAOZbTWvsuirv63V3BJ9aI) Lucas Zanella lucas.zanella@mercedes-benz.com, Mercedes-Benz Tech Innovation GmbH Provider Information flyteorg/flyte