Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle variable substitution per values element. #1031

Open
chaospuppy opened this issue Dec 3, 2024 · 0 comments
Open

Toggle variable substitution per values element. #1031

chaospuppy opened this issue Dec 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@chaospuppy
Copy link

chaospuppy commented Dec 3, 2024

Is your feature request related to a problem? Please describe

When setting values within a uds-bundle.yaml, it is sometimes required that a literal environment variable key is passed on as an override. For example, this happens to be the case for Loki. In Loki, when the config.expand-env argument is called for the Loki binary, Loki will then expand references to environment variables (values matching the same regex syntax as we use in UDS CLI) and use their values at runtime. However, if today you attempt to set the value of a helm values path to something like "${EXAMPLE}", you would see the override value rendered as ${EXAMPLE_not_found} because you did not set ${EXAMPLE} with UDS_EXAMPLE, or with --set, or in uds-config.yaml.

Because it's a bit confusing to describe in words, here is what I want in the final configmap, after UDS has deployed my bundle/package/helm chart:

kind: ConfigMap
metadata:
  name: example-data
data:
  myconf.yaml: |
       some-setting: "${EXAMPLE}"

And here's how I'd like to supply that value to the configmap via uds-bundle:

values:
  - path: path.to.myconf.some-setting
     value: "${EXAMPLE}"

Today I get

kind: ConfigMap
metadata:
  name: example-data
data:
  myconf.yaml: |
       some-setting: "${EXAMPLE_not_found}"

Describe the solution you'd like

  • Given a state
  • When an action is taken
  • Then something happens

Given the presence of a value in uds-bundle.yaml that matches the regex, when I set the attribute substitute to false for the value matching the regex, with would like the UDS CLI to NOT attempt to substitute the value of the value key. E.g.

values:
  - path: path.to.myconf.some-setting
    value: "${EXAMPLE}"
    substitute: false

Describe alternatives you've considered

You can currently work around this by turning the values element into a variables element and then setting, for example UDS_EXAMPLE='${EXAMPLE}', which then just substitutes ${EXAMPLE} in the uds-bundle.yaml with ${EXAMPLE}. The same process works for --set or specifying the value to be substituted in uds-config.yaml, or even as a values.yaml passed as a valuesFile to the UDS package. This feels a bit clunky though, seeing as the name of the environment variable isn't likely to change all that often, so hardcoding it as a value is more clear.

Additional context

Add any other context or screenshots about the feature request here.

@chaospuppy chaospuppy added the enhancement New feature or request label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant