How can the tool vals be used with Garden?
# 🌱|help-and-getting-started
g
https://github.com/helmfile/vals This tool allows for Helm values files to be written with references to values that can be fetched from a variety of external providers. Currently I rely on some hacky shell scripts to populate my values files. It'd be nice if I could have the Garden Helm deploy action use vals somehow. If the
helm apply
command used by Garden were customizable, this may be possible. I could set it to
vals eval -f values.yaml | helm apply -f -
, or if Garden currently pipes the values file into
helm
, then this could instead be
vals eval -f - | helm apply -f -
.
I suppose I could use the
helm
flag
--post-renderer
, and point it to a shell script that calls
vals eval -f -
Though I'd have to find a way to add this shell script to the container that Garden is using to run Helm
f
Hi @glamorous-kangaroo-20427 , adding an option to completely override the commands that are used to install or upgrade helm charts is a bit hard for us to do, because we do apply all kinds of options based on different inputs. However you could create an exec Run action (see https://docs.garden.io/reference/action-types/run/exec) which will run
vals eval
on the values file for helm before using the actual helm deploy action. You can have the helm deploy action depend on the Run action, which will make sure that the values file is rendered by
vals
before the helm deploy action runs. And just as a side note garden does not run Helm in a container but on your local machine.
g
Thank you for the suggestion @freezing-pharmacist-34446! That's what I ended up doing, although I wanted to avoid the secrets being saved to our devs' computers, so I had
vals
print them to stdout instead of to a file, and then in the Helm deploy action I use:
Copy code
yaml
spec:
  values:
    $merge: ${yamlDecode(actions.run.render-vals.outputs.log)}
This works well, but unfortunately I wasn't able to find any way to prevent Garden from displaying stdout for this run action. I couldn't find a feature request around having Garden hide the output from the terminal, so I created one: https://github.com/garden-io/garden/issues/6557
I also created a feature request to have separate outputs for stdout and stderr, since currently I have to send stderr to
/dev/null
in a couple spots since it's getting mixed up in the output with the credentials: https://github.com/garden-io/garden/issues/6556
27 Views