Skip to content

Commit

Permalink
feat: add sync policy option 'manual' for app create command
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhsudhir committed Mar 10, 2024
1 parent 542890f commit af105f8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func printAppSummaryTable(app *argoappv1.Application, appURL string, windows *ar
syncPolicy += " (Prune)"
}
} else {
syncPolicy = "<none>"
syncPolicy = "Manual"
}
fmt.Printf(printOpFmtStr, "Sync Policy:", syncPolicy)
syncStatusStr := string(app.Status.Sync.Status)
Expand Down Expand Up @@ -1516,7 +1516,7 @@ func NewApplicationListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co

func formatSyncPolicy(app argoappv1.Application) string {
if app.Spec.SyncPolicy == nil || app.Spec.SyncPolicy.Automated == nil {
return "<none>"
return "Manual"
}
policy := "Auto"
if app.Spec.SyncPolicy.Automated.Prune {
Expand All @@ -1543,7 +1543,7 @@ func formatConditionsSummary(app argoappv1.Application) string {
items = append(items, cndType)
}
}
summary := "<none>"
summary := "Manual"
if len(items) > 0 {
summary = strings.Join(items, ",")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/util/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func AddAppFlags(command *cobra.Command, opts *AppOptions) {
command.Flags().StringArrayVar(&opts.helmSetFiles, "helm-set-file", []string{}, "Helm set values from respective files specified via the command line (can be repeated to set several values: --helm-set-file key1=path1 --helm-set-file key2=path2)")
command.Flags().BoolVar(&opts.helmSkipCrds, "helm-skip-crds", false, "Skip helm crd installation step")
command.Flags().StringVar(&opts.project, "project", "", "Application project name")
command.Flags().StringVar(&opts.syncPolicy, "sync-policy", "", "Set the sync policy (one of: none, automated (aliases of automated: auto, automatic))")
command.Flags().StringVar(&opts.syncPolicy, "sync-policy", "", "Set the sync policy (one of: none, manual, automated (aliases of automated: auto, automatic))")
command.Flags().StringArrayVar(&opts.syncOptions, "sync-option", []string{}, "Add or remove a sync option, e.g add `Prune=false`. Remove using `!` prefix, e.g. `!Prune=false`")
command.Flags().BoolVar(&opts.autoPrune, "auto-prune", false, "Set automatic pruning when sync is automated")
command.Flags().BoolVar(&opts.selfHeal, "self-heal", false, "Set self healing when sync is automated")
Expand Down Expand Up @@ -166,7 +166,7 @@ func SetAppSpecOptions(flags *pflag.FlagSet, spec *argoappv1.ApplicationSpec, ap
spec.Project = appOpts.project
case "sync-policy":
switch appOpts.syncPolicy {
case "none":
case "none", "manual":
if spec.SyncPolicy != nil {
spec.SyncPolicy.Automated = nil
}
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ argocd app create APPNAME [flags]
--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: none, automated (aliases of automated: auto, automatic))
--sync-policy string Set the sync policy (one of: none, manual, 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)
--sync-retry-backoff-factor int Factor multiplies the base duration after each failed sync retry (default 2)
--sync-retry-backoff-max-duration duration Max sync retry backoff duration. Input needs to be a duration (e.g. 2m, 1h) (default 3m0s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ export const ApplicationSummary = (props: ApplicationSummaryProps) => {
<div className='white-box__details'>
<p>SYNC POLICY</p>
<div className='row white-box__details-row'>
<div className='columns small-3'>{(app.spec.syncPolicy && app.spec.syncPolicy.automated && <span>AUTOMATED</span>) || <span>NONE</span>}</div>
<div className='columns small-3'>{(app.spec.syncPolicy && app.spec.syncPolicy.automated && <span>AUTOMATED</span>) || <span>Manual</span>}</div>
<div className='columns small-9'>
{(app.spec.syncPolicy && app.spec.syncPolicy.automated && (
<button className='argo-button argo-button--base' onClick={() => unsetAutoSync(ctx)}>
Expand Down

0 comments on commit af105f8

Please sign in to comment.