Hey guys, I'm trying to pass environment variables...
# flyte-deployment
Hey guys, I'm trying to pass environment variables to my pods. I'm using flyte-binary deployment. For some reason, the task pods are getting the environment variables with their name lowercased. Other environment values passed by Flyte to the pod are not lowercased, only the added values via the k8s plugin. This is the relevant snippet from the `values.yaml`:
Copy code
        inject-finalizer: false
          FLYTE_AWS_ACCESS_KEY_ID: "foo"
          FLYTE_AWS_SECRET_ACCESS_KEY: "secret-bar"
          FLYTE_AWS_ENDPOINT: "custom-endpoint"
I logged into the binary pod and located the inline config:
. I can clearly see that the
is not lowercased. I tried a little to locate the relevant Go code but didn't find anything that lower-case the env var names. Thanks for your help!
I figured out what was the issue - For some reason the type definition
DefaultEnvVars map[string]string
means an array of map from string to string. Once I added
to all the entries, everything worked as expected. Not sure why this is the case...
@David Espejo (he/him) there was still a question there 🙂 Why if the type of the
is a map, the config file should be written as an array of maps?
@Guy Arad You mean you had to do something like this?
Copy code
  - FLYTE_AWS_ENDPOINT: "custom-endpoint"
Exactly. Without the dashes, i still saw the envvars, but their names were lower cased. I dont understand why it didnt fail altogether, and why the indicated type of map of string to string is expected to be array of maps of string to string
this is a known issue apparently, and the cause is not clear. Not really sure if it has something to do with the way Python handles YAML maps (as a dict?) BTW is this response helpful for you to some extent? https://flyte-org.slack.com/archives/C06H1SFA19R/p1707247529314789?thread_ts=1707247529.314789&cid=C06H1SFA19R
I believe it's related to the Go code and not Python. IIUC the Go part of Flyte (in the propeller?) is reading those from YAML into memory to the K8SPluginConfig object, and then construct the pod/container environment to spin up a new pod. Something in that deserialization into K8SPluginConfig object expect the YAML section to be a list of maps instead of what it seems the Go type (
) If you know Go, and have the ability to run it locally I'm open to having a quick debug session with one of the tests I saw in the repository
I don't know enough Go for this unf. In the meantime, could you please create an Issue for this? I can't find one for this specific problem cc @Eduardo Apolinario (eapolinario)