argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.04k stars 5.51k forks source link

New applicationset generate endpoint conflicts with existing one #20757

Open amit-o opened 2 weeks ago

amit-o commented 2 weeks ago

Checklist:

Describe the bug

Introduced in https://github.com/argoproj/argo-cd/commit/3a5b653fb153edff37ca1460ef34d44301bf23a5, the Generate defines post: /api/v1/applicationsets which already exists as the Create rpc, breaking the existing API.

To Reproduce

curl -XPOST http://localhost:4000/api/v1/applicationsets --d '{"apiVersion":"argoproj.io/v1alpha1","kind":"ApplicationSet","metadata":{"name":"guestbook"},"spec":{"goTemplate":true,"goTemplateOptions":["missingkey=error"],"generators":[],"template":{"metadata":{"name":"guestbook"},"spec":{"project":"my-project","source":{"repoURL":"https://github.com/infra-team/cluster-deployments.git","targetRevision":"HEAD","path":"guestbook/foo"},"destination":{"server":"localhost","namespace":"guestbook"}}}}}'
Results in a 500 

{"error":"error creating ApplicationSets: ApplicationSets is nil in request","code":2,"message":"error creating ApplicationSets: ApplicationSets is nil in request"}%

Expected behavior Should return 200 on a valid applicationset or 400 with an invalid

Screenshots

Version

dist/argocd version  
argocd: v2.14.0+b39f3b1.dirty
  BuildDate: 2024-11-11T16:13:12Z
  GitCommit: b39f3b15fbf1abf59177b58b6e87a44e32600bbe
  GitTreeState: dirty
  GoVersion: go1.22.0
  Compiler: gc
  Platform: darwin/arm64

Logs

Paste any relevant application logs here.