@@ -67,6 +67,7 @@ import (
67
67
appstatecache "github.com/argoproj/argo-cd/v3/util/cache/appstate"
68
68
"github.com/argoproj/argo-cd/v3/util/db"
69
69
"github.com/argoproj/argo-cd/v3/util/errors"
70
+ errorutils "github.com/argoproj/argo-cd/v3/util/errors"
70
71
"github.com/argoproj/argo-cd/v3/util/glob"
71
72
"github.com/argoproj/argo-cd/v3/util/helm"
72
73
logutils "github.com/argoproj/argo-cd/v3/util/log"
@@ -626,7 +627,7 @@ func (ctrl *ApplicationController) getResourceTree(destCluster *appv1.Cluster, a
626
627
return true
627
628
})
628
629
if err != nil {
629
- if ! isConversionWebhookError (err ) {
630
+ if ! errorutils . IsConversionWebhookError (err ) {
630
631
return nil , fmt .Errorf ("failed to iterate resource hierarchy v2: %w" , err )
631
632
}
632
633
@@ -666,7 +667,7 @@ func (ctrl *ApplicationController) getResourceTree(destCluster *appv1.Cluster, a
666
667
return true
667
668
})
668
669
if err != nil {
669
- if ! isConversionWebhookError (err ) {
670
+ if ! errorutils . IsConversionWebhookError (err ) {
670
671
return nil , fmt .Errorf ("failed to iterate resource hierarchy v2 for orphaned resources: %w" , err )
671
672
}
672
673
@@ -1827,6 +1828,10 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
1827
1828
hasCacheIssues := false
1828
1829
usesTaintedResources := false
1829
1830
1831
+ // Take a snapshot of cluster taint state to ensure consistency throughout the function
1832
+ clusterURL := app .Spec .Destination .Server
1833
+ failedGVKs := ctrl .stateCache .GetTaintedGVKs (clusterURL )
1834
+
1830
1835
// 1. First check if the app itself reports conversion webhook errors
1831
1836
hasCacheIssues = hasClusterCacheIssues (app )
1832
1837
@@ -1854,16 +1859,8 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
1854
1859
}
1855
1860
}
1856
1861
1857
- // 4. Check if the app directly uses any tainted resources
1858
- clusterURL := app .Spec .Destination .Server
1859
- // Check if cluster is tainted directly using our cluster taint tracking
1860
- allTaints := statecache .GetClusterTaints ()
1861
- taints , exists := allTaints [clusterURL ]
1862
-
1863
- // If the cluster is tainted, check if the app uses any of the affected resource types
1864
- if exists && len (taints ) > 0 {
1865
- // Check if app directly uses any of the tainted GVKs
1866
- failedGVKs := statecache .GetTaintedGVKs (clusterURL )
1862
+ // 4. Check if the app directly uses any tainted resources (using consistent snapshot)
1863
+ if len (failedGVKs ) > 0 {
1867
1864
1868
1865
resLoop:
1869
1866
for _ , res := range app .Status .Resources {
0 commit comments