Argocd: Matrix generator: map has no entry for key "config"

124 views Asked by At

I am trying to get config from the git file generator and give it as input to the list generator

Below is my configuration

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: child-app-template
spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
   - matrix:
      generators:
        - list: 
            elements:
              - name: component1
                namespace: app1
              - name: component2
                namespace: app2
        - matrix :
            generators:
            - git:
               repoURL: https://github.com/shamonshan/argocd-root
               revision: HEAD
               files:
               - path: configs/repo.yaml
            - list:
                elements: []
                elementsYaml: "{{ .config.repos | toJson }}"
  template:
    metadata:
      name: '{{.name}}-{{.application}}'
    spec:
      project: appbundle-project-dev
      destination:
        name: in-cluster
        namespace: '{{.namespace}}'
      source:
        repoURL: '{{.url}}'
        path : helm
        targetRevision: '{{.version}}'

While running the above i got the following error

failed to get params for second generator in the matrix generator: child generator returned an error on parameter generation: failed to replace parameters in generator: failed to execute go template {{ .config.repos | toJson }}: template: :1:10: executing "" at <.config.repos>: map has no entry for key "config"

But the configs/repo.yaml is existing and the content is below

config:
 repos:  
    - url: https://github.com/shamonshan/argocd-demo-deployment.git
      application: fc
      version: HEAD
    - url: https://github.com/shamonshan/argocd-demo-deployment-1.git
      application: wl
      version: HEAD
    - url: https://github.com/shamonshan/argocd-demo-deployment-1.git
      application: bill
      version: HEAD

What i m trying to achive is to combine the sources from two git generators and trying to produce a combination using matrix generator

0

There are 0 answers