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

Argo CD CLI prevents appset from being created when using list generator with empty array #17450

Closed
2 of 3 tasks
blakepettersson opened this issue Mar 8, 2024 · 0 comments · Fixed by #17424
Closed
2 of 3 tasks
Labels
bug Something isn't working

Comments

@blakepettersson
Copy link
Member

blakepettersson commented Mar 8, 2024

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

An Akuity customer reported that they are having difficulties creating an ApplicationSet with the Argo CD CLI. The ApplicationSet consists of a matrix generator that uses both the git (file) generator, and a list generator. When they try to apply the ApplicationSet with the command argocd appset create <file> they get the following error:

time="2024-02-29T12:16:12+05:30" level=fatal msg="rpc error: code = InvalidArgument desc = error creating ApplicationSet: [ApplicationSet.argoproj.io](http://applicationset.argoproj.io/) \"foobar\" is invalid: spec.generators[0].matrix.generators[1].list.elements: Required value

This seems to be a bug that occurs only with the CLI. When applying the ApplicationSet using the app-of-apps pattern, the ApplicationSet deploys and generates the expected Application resources.

To Reproduce

Here's an ApplicationSet yaml that I tested with works with app-of-apps, but not using the CLI.

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "0"
  name: some-random-app
  namespace: argocd
spec:
  goTemplate: true
  generators:
    - matrix:
        generators:
          - list:
              elements: []

  syncPolicy: {}
  template:
    metadata:
      name: "some-random-app"
    spec:
      project: default
      source:
        repoURL: https://github.com/argoproj/argocd-example-apps.git
        path: helm-dependency
        targetRevision: main
      destination:
        name: '{{.name}}'
        namespace: 'some-random-app'
      syncPolicy:
        automated:
          allowEmpty: true
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
          - ApplyOutOfSyncOnly=true

This also applies for a bare list generator (that's not a part of a matrix generator)

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "0"
  name: some-random-app
  namespace: argocd
spec:
  goTemplate: true
  generators:
    - list:
        elements: []
  syncPolicy: {}
  template:
    metadata:
      name: "some-random-app"
    spec:
      project: default
      source:
        repoURL: https://github.com/argoproj/argocd-example-apps.git
        path: helm-dependency
        targetRevision: main
      destination:
        name: '{{.name}}'
        namespace: 'some-random-app'
      syncPolicy:
        automated:
          allowEmpty: true
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
          - ApplyOutOfSyncOnly=true

If you apply the first one with argocd appset create <file> you'll get

rpc error: code = InvalidArgument desc = error creating ApplicationSet: ApplicationSet.argoproj.io "some-random-app" is invalid: spec.generators[0].matrix.generators[0].list.elements: Required value 

If you apply the second one with argocd appset create <file> you'll get

rpc error: code = InvalidArgument desc = error creating ApplicationSet: ApplicationSet.argoproj.io "some-random-app" is invalid: spec.generators[0].list.elements: Required value 

Expected behavior

No errors.

Version

argocd: v2.9.3+6eba5be.dirty
  BuildDate: 2023-12-02T00:46:25Z
  GitCommit: 6eba5be864b7e031871ed7698f5233336dfe75c7
  GitTreeState: dirty
  GoVersion: go1.21.4
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v2.9.0+a93f05d.dirty
  BuildDate: 2024-03-08T13:04:27Z
  GitCommit: a93f05d0f0c7583f9a62187b5bf97cc1227adfa4
  GitTreeState: dirty
  GoVersion: go1.21.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
  Helm Version: v3.14.2+gc309b6f
  Kubectl Version: v0.26.11
  Jsonnet Version: v0.20.0
@blakepettersson blakepettersson added the bug Something isn't working label Mar 8, 2024
@blakepettersson blakepettersson changed the title Argo CD CLI prevents appset from being created when using git+list generator with elementsYaml Argo CD CLI prevents appset from being created when using list generator Mar 8, 2024
@blakepettersson blakepettersson changed the title Argo CD CLI prevents appset from being created when using list generator Argo CD CLI prevents appset from being created when using list generator with empty array Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant