-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(cli): add cmd to preview generated apps of appsets (#10895) #16781
Conversation
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
…ist-apps Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16781 +/- ##
==========================================
- Coverage 50.28% 50.25% -0.04%
==========================================
Files 312 315 +3
Lines 43020 43125 +105
==========================================
+ Hits 21633 21671 +38
- Misses 18905 18971 +66
- Partials 2482 2483 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
This feature is really needed in order to do any meaningful dryrun if using applicationset. In production environment, we have to review the dryrun changes before any updates to applicationset could be landed. With this PR in place, we could get a list of applications, and then we could iterate the list of applications to get its diff via "argocd app diff" command at least. Without this PR in place, there's no way to do any meaningful dryrun for applicationset. This is the most needed feature for argocd applicationset. |
@argoproj/argocd-approvers The dependency seems to be coupled with a few other PRs and may take some time to merge. |
👍 Long-waited feature to allow simple and reliable validations on any non-trivial manifests repo that uses appset |
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=Generator | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think --name=generator
or make codegen again
Currently, the go generate command generates Generator.go, not generator.go.
//go:generate go run github.com/vektra/mockery/v2@v2.40.2 --name=Renderer | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think --name=renderer or make codegen again
Currently, the go generate command generates Renderer.go, not renderer.go.
…) (argoproj#16781) * feat(cli): add cmd to preview generated apps Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix build Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix local proto gen Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * dry run client Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix: allow to run codegen outside GOPATH Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * clientgen Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * openapigen Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * remove ensure-gopath Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix tests and templatePatch Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix build Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * convert to interfaces Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * codegen Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * extract common code Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * use appset params in server Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * codegen Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * fix test build Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * unit tests Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * move test to new package Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * move to correct folders Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * fix build Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * review Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * auto generate mocks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * better error handling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * more docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * more docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…) (argoproj#16781) * feat(cli): add cmd to preview generated apps Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix build Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix local proto gen Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * dry run client Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix: allow to run codegen outside GOPATH Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * clientgen Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * openapigen Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * remove ensure-gopath Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix tests and templatePatch Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix build Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * convert to interfaces Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * codegen Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * extract common code Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * use appset params in server Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * codegen Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * fix test build Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * unit tests Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * move test to new package Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * move to correct folders Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * fix build Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * review Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> * lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * auto generate mocks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * better error handling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * more docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * more docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Javier Solana <javier.solana@cabify.com> Signed-off-by: Javier Solana <javier.solana@cabify.com>
This feature was marked as having been completed in 2.12, but it is not anywhere on the 2.12 branch. I think we need to move it to 2.13 now. |
has this been included into 2.13? cannot see it in changelog. Any estimation on when could be available ? |
when is this going to be released? |
Closes #10895
The goal of this PR is to update the
argocd appset create
command to add a--dry-run
argument. When it is specified, the server will call the applicationSet templating and app generation logic to evaluate and transform all the generator. It will use the resulting applications to generate a list of "generated" application.To avoid creating a hard dependency between the server and applicationSet, which is not a default component of ArgoCD, the server does the templating based on the same configuration the ApplicationSet adds. If not configured the same, the generation may be different. Once ApplicationSet is a native components of Argo, the templating could be exposed as an api call, similar to how it is done with the repo-server component.
The output of this command will allow to compare the list of resulting applications with the output of
argocd appset get tests.simple-application -o json | jq -r '.status.resources[].name
to know which app will be added or removed once the manifest is applied.Suggestions
I think another CLI command could be
argocd appset template ./appset.yaml -o json
and return the list of templated applications with the full object and not only their name. Some people expressed the need to have the whole applications so they could validate the logic client-side.With the current implementation, only the app name is returned in create and the get.
An implementation to be able to do client-side diff would be to have the template command return the current AppSet with all the applications templated, and modify the get to return the full templated application as well (this would avoid an
argocd app get
for each generated apps).