@@ -163,6 +163,11 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
163163 return nil , nil , false , fmt .Errorf ("failed to get Helm settings: %w" , err )
164164 }
165165
166+ trackingMethod , err := m .settingsMgr .GetTrackingMethod ()
167+ if err != nil {
168+ return nil , nil , false , fmt .Errorf ("failed to get trackingMethod: %w" , err )
169+ }
170+
166171 installationID , err := m .settingsMgr .GetInstallationID ()
167172 if err != nil {
168173 return nil , nil , false , fmt .Errorf ("failed to get installation ID: %w" , err )
@@ -249,7 +254,7 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
249254 ApplicationSource : & source ,
250255 KubeVersion : serverVersion ,
251256 ApiVersions : apiVersions ,
252- TrackingMethod : string ( argo . GetTrackingMethod ( m . settingsMgr )) ,
257+ TrackingMethod : trackingMethod ,
253258 RefSources : refSources ,
254259 HasMultipleSources : app .Spec .HasMultipleSources (),
255260 InstallationID : installationID ,
@@ -286,7 +291,7 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
286291 ApiVersions : apiVersions ,
287292 VerifySignature : verifySignature ,
288293 HelmRepoCreds : permittedHelmCredentials ,
289- TrackingMethod : string ( argo . GetTrackingMethod ( m . settingsMgr )) ,
294+ TrackingMethod : trackingMethod ,
290295 EnabledSourceTypes : enabledSourceTypes ,
291296 HelmOptions : helmOptions ,
292297 HasMultipleSources : app .Spec .HasMultipleSources (),
@@ -435,24 +440,28 @@ func normalizeClusterScopeTracking(targetObjs []*unstructured.Unstructured, info
435440
436441// getComparisonSettings will return the system level settings related to the
437442// diff/normalization process.
438- func (m * appStateManager ) getComparisonSettings () (string , map [string ]v1alpha1.ResourceOverride , * settings.ResourcesFilter , string , error ) {
443+ func (m * appStateManager ) getComparisonSettings () (string , map [string ]v1alpha1.ResourceOverride , * settings.ResourcesFilter , string , string , error ) {
439444 resourceOverrides , err := m .settingsMgr .GetResourceOverrides ()
440445 if err != nil {
441- return "" , nil , nil , "" , err
446+ return "" , nil , nil , "" , "" , err
442447 }
443448 appLabelKey , err := m .settingsMgr .GetAppInstanceLabelKey ()
444449 if err != nil {
445- return "" , nil , nil , "" , err
450+ return "" , nil , nil , "" , "" , err
446451 }
447452 resFilter , err := m .settingsMgr .GetResourcesFilter ()
448453 if err != nil {
449- return "" , nil , nil , "" , err
454+ return "" , nil , nil , "" , "" , err
450455 }
451456 installationID , err := m .settingsMgr .GetInstallationID ()
452457 if err != nil {
453- return "" , nil , nil , "" , err
458+ return "" , nil , nil , "" , "" , err
454459 }
455- return appLabelKey , resourceOverrides , resFilter , installationID , nil
460+ trackingMethod , err := m .settingsMgr .GetTrackingMethod ()
461+ if err != nil {
462+ return "" , nil , nil , "" , "" , err
463+ }
464+ return appLabelKey , resourceOverrides , resFilter , installationID , trackingMethod , nil
456465}
457466
458467// verifyGnuPGSignature verifies the result of a GnuPG operation for a given git
@@ -503,7 +512,7 @@ func isManagedNamespace(ns *unstructured.Unstructured, app *v1alpha1.Application
503512// revision and overrides in the app spec.
504513func (m * appStateManager ) CompareAppState (app * v1alpha1.Application , project * v1alpha1.AppProject , revisions []string , sources []v1alpha1.ApplicationSource , noCache bool , noRevisionCache bool , localManifests []string , hasMultipleSources bool , rollback bool ) (* comparisonResult , error ) {
505514 ts := stats .NewTimingStats ()
506- appLabelKey , resourceOverrides , resFilter , installationID , err := m .getComparisonSettings ()
515+ appLabelKey , resourceOverrides , resFilter , installationID , trackingMethod , err := m .getComparisonSettings ()
507516
508517 ts .AddCheckpoint ("settings_ms" )
509518
@@ -612,10 +621,8 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
612621 infoProvider = & resourceInfoProviderStub {}
613622 }
614623
615- trackingMethod := argo .GetTrackingMethod (m .settingsMgr )
616-
617624 err = normalizeClusterScopeTracking (targetObjs , infoProvider , func (u * unstructured.Unstructured ) error {
618- return m .resourceTracking .SetAppInstance (u , appLabelKey , app .InstanceName (m .namespace ), app .Spec .Destination .Namespace , trackingMethod , installationID )
625+ return m .resourceTracking .SetAppInstance (u , appLabelKey , app .InstanceName (m .namespace ), app .Spec .Destination .Namespace , v1alpha1 . TrackingMethod ( trackingMethod ) , installationID )
619626 })
620627 if err != nil {
621628 msg := "Failed to normalize cluster-scoped resource tracking: " + err .Error ()
@@ -682,7 +689,7 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
682689
683690 for _ , liveObj := range liveObjByKey {
684691 if liveObj != nil {
685- appInstanceName := m .resourceTracking .GetAppName (liveObj , appLabelKey , trackingMethod , installationID )
692+ appInstanceName := m .resourceTracking .GetAppName (liveObj , appLabelKey , v1alpha1 . TrackingMethod ( trackingMethod ) , installationID )
686693 if appInstanceName != "" && appInstanceName != app .InstanceName (m .namespace ) {
687694 fqInstanceName := strings .ReplaceAll (appInstanceName , "_" , "/" )
688695 conditions = append (conditions , v1alpha1.ApplicationCondition {
@@ -821,7 +828,7 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
821828 }
822829 gvk := obj .GroupVersionKind ()
823830
824- isSelfReferencedObj := m .isSelfReferencedObj (liveObj , targetObj , app .GetName (), trackingMethod , installationID )
831+ isSelfReferencedObj := m .isSelfReferencedObj (liveObj , targetObj , app .GetName (), v1alpha1 . TrackingMethod ( trackingMethod ) , installationID )
825832
826833 resState := v1alpha1.ResourceStatus {
827834 Namespace : obj .GetNamespace (),
@@ -1145,7 +1152,7 @@ func (m *appStateManager) isSelfReferencedObj(live, config *unstructured.Unstruc
11451152
11461153 // If tracking method doesn't contain required metadata for this check,
11471154 // we are not able to determine and just assume the object to be managed.
1148- if trackingMethod == argo .TrackingMethodLabel {
1155+ if trackingMethod == v1alpha1 .TrackingMethodLabel {
11491156 return true
11501157 }
11511158
0 commit comments