applicationset icon indicating copy to clipboard operation
applicationset copied to clipboard

Passing Helm values to chart from Git file generator not working

Open pdrastil opened this issue 2 years ago • 3 comments

Hi I was trying to use Git file generator to deploy Helm chart with quite complex configuration and I hoped that it would be possible to pass values from my configuration yaml to template in ApplicationSet controller. If I do this based on the samples below it seems that {{values}} template is never expanded. Is this a bug or it's just not supported? Thanks

Sample ApplicationSet definition

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: complex-app
spec:
  template:
    metadata:
      name: "complex-app-{{ metadata.name }}"
   project: complex-app
   destination:
     name: "{{ metadata.cluster }}"
     namespace: complex-app
   source:
     repoURL: https://github.com/my/repo.git
    path: my/chart
    targetRevision: "{{metadata.revision}}"
    helm:
      values: "{{ values }}"

Sample config file

metadata:
  name: my-deployment
  cluster: my-cluster
  revision: 1.x
values:
  some:
    nested:
       config:
       - value1
       - value2

pdrastil avatar Sep 13 '21 18:09 pdrastil

At the moment, only string key-value pairs are supported.

jgwest avatar Sep 29 '21 02:09 jgwest

Not ideal but you can put a pipe '|' next to values in your config file. That way it will be interpreted as string.. and in fact in your appset you're referring to helm/values not valueFiles, so it really needs a string

romuduck avatar Jan 05 '22 22:01 romuduck

@pdrastil try updating your config file to look like this:

metadata:
  name: my-deployment
  cluster: my-cluster
  revision: 1.x
values: |
  some:
    nested:
       config:
       - value1
       - value2

This will cause all of the key/values within values to be stored as a single string. This should work with the say you are referencing {{values}} in your applicationset.

jwenz723 avatar May 27 '22 07:05 jwenz723