travisghansen / argo-cd-helmfile

Integration between argo-cd and helmfile
MIT License
213 stars 55 forks source link

helmfile/vals integration #42

Closed crabique closed 1 year ago

crabique commented 1 year ago

Hello,

Is it possible to enable the https://github.com/helmfile/vals templating pass during the manifests render so that external values can be used as well?

travisghansen commented 1 year ago

Never used it but looks cool. The idea would be to pass the entire output through vals as a post processing pass?

travisghansen commented 1 year ago

https://github.com/travisghansen/argo-cd-helmfile/blob/master/src/argo-cd-helmfile.sh#L406

crabique commented 1 year ago

Yes, in my specific use case I'm interested in fetching data directly from terraform statefile on an S3 bucket into the environment helmfile so it's available as a .StateValue, but it seems there's no real difference as the processing can only happen after helmfile template output.

travisghansen commented 1 year ago

Yeah, so basically all we need to do would be something like this:

  export HELMFILE_POST_PROCESS=" | vals eval -f - "

    ${helmfile} \
      template \
      --skip-deps ${INTERNAL_HELMFILE_TEMPLATE_OPTIONS} \
      --args "${INTERNAL_HELM_TEMPLATE_OPTIONS} ${HELM_TEMPLATE_OPTIONS}" \
      ${HELMFILE_TEMPLATE_OPTIONS} ${HELMFILE_POST_PROCESS}
    ;;
travisghansen commented 1 year ago

From what I can tell helmfile already has support for this built-in. My testing shows the refs/values being rendered without even installing the vals binary independently.

crabique commented 1 year ago

Oh my, you are right, I just searched their documentation by ref keyword and found this: https://helmfile.readthedocs.io/en/latest/remote-secrets/

Sorry 😄

Thanks for the very quick response!

travisghansen commented 1 year ago

I didn't even read that, but this works as well:

# both syntaxes below work for me
releases:
- name: grafana
  namespace: monitoring
  chart: stable/grafana
  set:
  - name: adminPassword
    value: ref+envsubst://$VAR1
  ...
  values:
  - adminPassword: ref+envsubst://$VAR1