Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,10 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
Prune: prune,
}
switch strategy {
case "", "apply":
case "apply":
syncReq.Strategy = &argoappv1.SyncStrategy{Apply: &argoappv1.SyncStrategyApply{}}
syncReq.Strategy.Apply.Force = force
case "hook":
case "", "hook":
syncReq.Strategy = &argoappv1.SyncStrategy{Hook: &argoappv1.SyncStrategyHook{}}
syncReq.Strategy.Hook.Force = force
default:
Expand Down
12 changes: 6 additions & 6 deletions controller/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ func (sc *syncContext) sync() {
}

// All objects passed a `kubectl apply --dry-run`, so we are now ready to actually perform the sync.
if sc.syncOp.SyncStrategy == nil {
// default sync strategy to hook if no strategy
sc.syncOp.SyncStrategy = &appv1.SyncStrategy{Hook: &appv1.SyncStrategyHook{}}
}
if sc.syncOp.SyncStrategy.Apply != nil {
forceApply := false
if sc.syncOp.SyncStrategy != nil && sc.syncOp.SyncStrategy.Apply != nil {
forceApply = sc.syncOp.SyncStrategy.Apply.Force
}
sc.doApplySync(syncTasks, false, forceApply)
} else if sc.syncOp.SyncStrategy.Hook != nil || sc.syncOp.SyncStrategy == nil {
sc.doApplySync(syncTasks, false, sc.syncOp.SyncStrategy.Apply.Force)
} else if sc.syncOp.SyncStrategy.Hook != nil {
hooks, err := sc.getHooks()
if err != nil {
sc.setOperationPhase(appv1.OperationError, fmt.Sprintf("failed to generate hooks resources: %v", err))
Expand Down