https://flyte.org logo
#flyte-deployment
Title
# flyte-deployment
g

Guy Arad

02/04/2024, 11:05 AM
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
...
configuration
  ...
  inline:
    plugins:
      k8s:
        inject-finalizer: false
        default-env-vars:
          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:
/etc/flyte/config.d/100-inline-config.yaml
. I can clearly see that the
default-env-vars
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
DefaultEnvVars
is a map, the config file should be written as an array of maps?
d

David Espejo (he/him)

02/06/2024, 7:24 PM
@Guy Arad You mean you had to do something like this?
Copy code
default-env-vars:
  - FLYTE_AWS_ACCESS_KEY_ID: "foo"
  - FLYTE_AWS_SECRET_ACCESS_KEY: "secret-bar"
  - FLYTE_AWS_ENDPOINT: "custom-endpoint"
g

Guy Arad

02/06/2024, 9:21 PM
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
d

David Espejo (he/him)

02/08/2024, 3:14 PM
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
g

Guy Arad

02/08/2024, 4:50 PM
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 (
map[string]string
) 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
d

David Espejo (he/him)

02/08/2024, 5:04 PM
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)
7 Views