Skip to content

Commit

Permalink
feat: add set-finallizer on argocd admin app generate-spec command (a…
Browse files Browse the repository at this point in the history
…rgoproj#18855)

* added set-finallizer on argocd admin command

Signed-off-by: AvivGuiser <aviv.guiser@placer.ai>

* ran make-codegen

Signed-off-by: AvivGuiser <aviv.guiser@placer.ai>

---------

Signed-off-by: AvivGuiser <aviv.guiser@placer.ai>
Co-authored-by: pasha-codefresh <pavel@codefresh.io>
  • Loading branch information
2 people authored and ggjulio committed Jul 21, 2024
1 parent 6ce58ce commit 8c955ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/argocd/commands/admin/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func NewGenAppSpecCommand() *cobra.Command {
outputFormat string
annotations []string
inline bool
setFinalizer bool
)
command := &cobra.Command{
Use: "generate-spec APPNAME",
Expand Down Expand Up @@ -112,7 +113,9 @@ func NewGenAppSpecCommand() *cobra.Command {
c.HelpFunc()(c, args)
os.Exit(1)
}

if setFinalizer {
app.Finalizers = append(app.Finalizers, "resources-finalizer.argocd.argoproj.io")
}
out, closer, err := getOutWriter(inline, fileURL)
errors.CheckError(err)
defer io.Close(closer)
Expand All @@ -126,6 +129,7 @@ func NewGenAppSpecCommand() *cobra.Command {
command.Flags().StringArrayVarP(&annotations, "annotations", "", []string{}, "Set metadata annotations (e.g. example=value)")
command.Flags().StringVarP(&outputFormat, "output", "o", "yaml", "Output format. One of: json|yaml")
command.Flags().BoolVarP(&inline, "inline", "i", false, "If set then generated resource is written back to the file specified in --file flag")
command.Flags().BoolVar(&setFinalizer, "set-finalizer", false, "Sets deletion finalizer on the application, application resources will be cascaded on deletion")

// Only complete files with appropriate extension.
err := command.Flags().SetAnnotation("file", cobra.BashCompFilenameExt, []string{"json", "yaml", "yml"})
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_app_generate-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ argocd admin app generate-spec APPNAME [flags]
--revision string The tracking source branch, tag, commit or Helm chart version the application will sync to
--revision-history-limit int How many items to keep in revision history (default 10)
--self-heal Set self healing when sync is automated
--set-finalizer Sets deletion finalizer on the application, application resources will be cascaded on deletion
--sync-option Prune=false Add or remove a sync option, e.g add Prune=false. Remove using `!` prefix, e.g. `!Prune=false`
--sync-policy string Set the sync policy (one of: manual (aliases of manual: none), automated (aliases of automated: auto, automatic))
--sync-retry-backoff-duration duration Sync retry backoff base duration. Input needs to be a duration (e.g. 2m, 1h) (default 5s)
Expand Down

0 comments on commit 8c955ee

Please # to comment.