Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <[email protected]>
  • Loading branch information
crenshaw-dev committed Dec 18, 2024
1 parent d732690 commit 2b292ef
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions controller/appcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1636,16 +1636,17 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
}).Info("Reconciliation completed")
}()

destCluster, err := argo.GetDestinationCluster(context.Background(), app.Spec.Destination, ctrl.db)
if err != nil {
logCtx.Errorf("Failed to get destination cluster: %v", err)
return
}

if comparisonLevel == ComparisonWithNothing {
managedResources := make([]*appv1.ResourceDiff, 0)
if err := ctrl.cache.GetAppManagedResources(app.InstanceName(ctrl.namespace), &managedResources); err != nil {
logCtx.Warnf("Failed to get cached managed resources for tree reconciliation, fall back to full reconciliation")
} else {
destCluster, err := argo.GetDestinationCluster(context.Background(), app.Spec.Destination, ctrl.db)
if err != nil {
logCtx.Errorf("Failed to get destination cluster: %v", err)
return
}
var tree *appv1.ApplicationTree
if tree, err = ctrl.getResourceTree(destCluster, app, managedResources); err == nil {
app.Status.Summary = tree.GetSummary(app)
Expand Down Expand Up @@ -1712,12 +1713,6 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
sources = append(sources, app.Spec.GetSource())
}

destCluster, err := argo.GetDestinationCluster(context.Background(), app.Spec.Destination, ctrl.db)
if err != nil {
logCtx.Errorf("Failed to get destination cluster: %v", err)
return
}

compareResult, err := ctrl.appStateManager.CompareAppState(destCluster, app, project, revisions, sources,
refreshType == appv1.RefreshTypeHard,
comparisonLevel == CompareWithLatestForceResolve, localManifests, hasMultipleSources, false)
Expand Down

0 comments on commit 2b292ef

Please sign in to comment.