Adding envs key Helm values to gateway resources - #688
Conversation
There was a problem hiding this comment.
Thank you @JoeJasinski for your thorough descriptions in PR and issue!!! ❤️ 🎉 🌻
I'm 👍 for supporting gateway.env as a configuration, but I want it to be fully k8s compatible and support valueFrom for example.
I've made comments to help you work towards that!
| env: &env-spec | ||
| type: array | ||
| items: | ||
| type: object | ||
| additionalProperties: false | ||
| properties: | ||
| name: | ||
| type: string | ||
| description: | | ||
| The name of the environment variable to pass to the pod | ||
| value: | ||
| type: string | ||
| description: | | ||
| The value of the environment variable to pass to the pod | ||
| required: | ||
| - name | ||
| - value | ||
| description: | | ||
| Additional environment variables to apply to the resource |
There was a problem hiding this comment.
This should allow for configuration as declared in https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core, including name (string), value (string), and valueFrom (object).
I'd like to see that:
- the description mention that users should use the k8s official configuration syntax
- properties entries for name/value/valueFrom declaring them string/string/object, you can skip the descriptions here to defer to the k8s official docs instead
- for the valueFrom object, just declare
additionalProperties: trueand don't declare its properties - remove the
&env-specanchor definition if its not used elsewhere - Only
nameis required as otherwise you can't choose from eithervalueorvalueFrom.
|
@consideRatio Thank you for the feedback. I like that approach of allowing the downward API access to set environment variables. I'll make these changes. |
MR Feedback from @considerRadio to support the valueFrom syntax for environment variables as well. Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
MR Feedback from @considerRadio to support the valueFrom syntax for environment variables as well. Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
…ng environment variables to the gateway via the valueFrom syntax of the downard api
|
@consideRatio Thank you again for the review. I believe I made the changes that you pointed out. I like the toYaml loop that you added for the environment variable spec; I'll have to include that in my Helm charts. I've updated the jsonschema to allow for the valuesFrom key. Let me know if there are any other updates you'd like me to make. |
|
Wieee this looks great! Thank you @JoeJasinski!! ❤️ 🎉 🌻 |
This MR is to enhance this use-case where one wishes to customize the extraConfig that's passed to the gateway via the configmap. Currently, according to the documentation, you can create additional python configuration for any of the Traitlet-enhanced classes from the "Configuration Reference".
However, it would be nice to be able to pass in environment variables to that config, so you could set the python config additions, but tune them by making a change to an environment variable rather than via making python code changes.
Take this simple Helm values file example:
If I wanted to customize the config values, I'd have to override the entire config, or create a new "extraConfig" key.
However, it would be nice to be able to do the following:
Then, you could easily change those config values by passing in environment variables to the helm chart without having to change the python code.
This MR is to change the helm chart so that it accepts an "envs" list of dicts that get passed to the gateway deployment where the dask gateway config ConfigMap gets passed into the gateway.
Does this sound like a feature that would be useful?