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

extraObjects does work with ApplicationSet in ArgoCd #1882

Closed
oisin88 opened this issue Mar 2, 2023 · 1 comment
Closed

extraObjects does work with ApplicationSet in ArgoCd #1882

oisin88 opened this issue Mar 2, 2023 · 1 comment
Labels
argo-cd bug Something isn't working invalid Not a valid bug

Comments

@oisin88
Copy link

oisin88 commented Mar 2, 2023

Describe the bug

The value "extraObjects" does not work when the type is Argo "ApplicationSet".

If you you add the sample ApplicationSet from Argo Docs to values.yaml under extraObjects.

https://argo-cd.readthedocs.io/en/stable/user-guide/application-set/

and run

helm template .

it fails with:

Error: template: argo-cd/templates/extra-manifests.yaml:3:3: executing "argo-cd/templates/extra-manifests.yaml" at <tpl (toYaml .) $>: error calling tpl: error during tpl function execution for "apiVersion: argoproj.io/v1alpha1\nkind: ApplicationSet\nmetadata:\n name: guestbook\nspec:\n generators:\n - list:\n elements:\n - cluster: engineering-dev\n url: https://1.2.3.4\n - cluster: engineering-prod\n url: https://2.4.6.8\n - cluster: finance-preprod\n url: https://9.8.7.6\n template:\n metadata:\n name: '{{cluster}}-guestbook'\n spec:\n destination:\n namespace: guestbook\n server: '{{url}}'\n project: default\n source:\n path: applicationset/examples/list-generator/guestbook/{{cluster}}\n repoURL: https://github.com/argoproj/argo-cd.git\n targetRevision: HEAD": parse error at (argo-cd/templates/extra-manifests.yaml:17): function "cluster" not defined helm.go:84: [debug] template: argo-cd/templates/extra-manifests.yaml:3:3: executing "argo-cd/templates/extra-manifests.yaml" at <tpl (toYaml .) $>: error calling tpl: error during tpl function execution for "apiVersion: argoproj.io/v1alpha1\nkind: ApplicationSet\nmetadata:\n name: guestbook\nspec:\n generators:\n - list:\n elements:\n - cluster: engineering-dev\n url: https://1.2.3.4\n - cluster: engineering-prod\n url: https://2.4.6.8\n - cluster: finance-preprod\n url: https://9.8.7.6\n template:\n metadata:\n name: '{{cluster}}-guestbook'\n spec:\n destination:\n namespace: guestbook\n server: '{{url}}'\n project: default\n source:\n path: applicationset/examples/list-generator/guestbook/{{cluster}}\n repoURL: https://github.com/argoproj/argo-cd.git\n targetRevision: HEAD": parse error at (argo-cd/templates/extra-manifests.yaml:17): function "cluster" not defined coder@oisin-devspace:~/mycode/argo-helm/charts/argo-cd$ helm template . Error: template: argo-cd/templates/extra-manifests.yaml:3:3: executing "argo-cd/templates/extra-manifests.yaml" at <tpl (toYaml .) $>: error calling tpl: error during tpl function execution for "apiVersion: argoproj.io/v1alpha1\nkind: ApplicationSet\nmetadata:\n name: guestbook\nspec:\n generators:\n - list:\n elements:\n - cluster: engineering-dev\n url: https://1.2.3.4\n - cluster: engineering-prod\n url: https://2.4.6.8\n - cluster: finance-preprod\n url: https://9.8.7.6\n template:\n metadata:\n name: '{{cluster}}-guestbook'\n spec:\n destination:\n namespace: guestbook\n server: '{{url}}'\n project: default\n source:\n path: applicationset/examples/list-generator/guestbook/{{cluster}}\n repoURL: https://github.com/argoproj/argo-cd.git\n targetRevision: HEAD": parse error at (argo-cd/templates/extra-manifests.yaml:17): function "cluster" not defined

It will render if you remove the curly bracers, but these will alomst always be in ApplicationSet.

Related helm chart

argo-cd

Helm chart version

5.24.0

To Reproduce

add to values.yaml

extraObjects: 
- apiVersion: argoproj.io/v1alpha1
  kind: ApplicationSet
  metadata:
    name: guestbook
  spec:
    generators:
    - list:
        elements:
        - cluster: engineering-dev
          url: https://1.2.3.4
        - cluster: engineering-prod
          url: https://2.4.6.8
        - cluster: finance-preprod
          url: https://9.8.7.6
    template:
      metadata:
        name: '{{cluster}}-guestbook'
      spec:
        project: default
        source:
          repoURL: https://github.com/argoproj/argo-cd.git
          targetRevision: HEAD
          path: applicationset/examples/list-generator/guestbook/{{cluster}}
        destination:
          server: '{{url}}'
          namespace: guestbook

run

helm template.

Expected behavior

This field should support all helm and kubernetes manifests. It should work with all Argo CRDs including application sets.

Screenshots

No response

Additional context

I am trying to create a multi instance argo setup using your chart. thanks it is great !

I want to use your chart for "master" and "worker" Argos. I would like the master Argo to create worker Argos using ApplicationSet.

The only real difference between the Worker and master apps will be the apps they sync. So extraObjects would be ideal if it supported extraObjects.

Thanks,
Oisin

@oisin88 oisin88 added the bug Something isn't working label Mar 2, 2023
@pdrastil pdrastil added invalid Not a valid bug argo-cd labels Mar 3, 2023
@pdrastil
Copy link
Member

pdrastil commented Mar 3, 2023

Hi @oisin88 this works as expected. You cannot use resources that don't exists in the cluster at the time of the installation. This chart installs CustomResourceDefinitions for ApplicationSet, Application and AppProject. For bootstrap there is argocd-apps chart that needs to installed after this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
argo-cd bug Something isn't working invalid Not a valid bug
Projects
None yet
Development

No branches or pull requests

2 participants