Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b71588a
mvp
pasha-codefresh Sep 16, 2021
ccb37cf
move tracking method on settings level
pasha-codefresh Sep 16, 2021
3ac41bb
tracking method support
pasha-codefresh Sep 17, 2021
1b71888
tracking method support
pasha-codefresh Sep 18, 2021
321574e
refactor way how to work with tracking method
pasha-codefresh Sep 19, 2021
6960389
refactor way how to work with tracking method
pasha-codefresh Sep 19, 2021
32a0955
rewrite way how to set label
pasha-codefresh Sep 20, 2021
0a77229
rewrite way how to set label
pasha-codefresh Sep 20, 2021
c1a0e16
rewrite way how to set label
pasha-codefresh Sep 20, 2021
4b3e7fc
rewrite way how to set label
pasha-codefresh Sep 21, 2021
1f53827
Merge branches 'master' and 'rename-app-id' of github.com:pasha-codef…
pasha-codefresh Sep 21, 2021
e84d14f
rewrite way how to set label
pasha-codefresh Sep 21, 2021
ee7324b
remove hardcoded annotation
pasha-codefresh Sep 21, 2021
0084614
remove redundant changes
pasha-codefresh Sep 21, 2021
4c9865a
regenrate code and fix test
pasha-codefresh Sep 21, 2021
19bdf43
Merge branches 'master' and 'rename-app-id' of github.com:pasha-codef…
pasha-codefresh Sep 21, 2021
9fe770c
fix test
pasha-codefresh Sep 21, 2021
cec4e1c
Merge branches 'master' and 'rename-app-id' of github.com:pasha-codef…
pasha-codefresh Sep 22, 2021
22daead
cover kube.go with tests
pasha-codefresh Sep 22, 2021
414e97b
add unit tests
pasha-codefresh Sep 22, 2021
2e76cae
rerun unit tests
pasha-codefresh Sep 22, 2021
35f3a67
Merge branches 'master' and 'rename-app-id' of github.com:pasha-codef…
pasha-codefresh Sep 22, 2021
eeaa466
add tracking method to cli
pasha-codefresh Sep 22, 2021
2bc8779
retrieve tracking method from application
pasha-codefresh Sep 23, 2021
dda5199
Merge branches 'rename-app-id' and 'rename-app-id-value-convention' o…
pasha-codefresh Sep 23, 2021
b15628e
regenerate structs
pasha-codefresh Sep 23, 2021
bc674a5
add comments
pasha-codefresh Sep 23, 2021
bcd5121
small refactoring
pasha-codefresh Sep 23, 2021
a9d7aa4
add tests
pasha-codefresh Sep 23, 2021
e300685
add tests
pasha-codefresh Sep 24, 2021
edaf1fa
tracking method for annotations should be in another format
pasha-codefresh Sep 28, 2021
d13caf0
not change behavior in case if tracking method is label or none
pasha-codefresh Sep 28, 2021
5384873
fix tests and encapsulate how value was built
pasha-codefresh Sep 28, 2021
98a1668
Merge branch 'master' of github.com:pasha-codefresh/argo-cd into trac…
pasha-codefresh Sep 29, 2021
c24fbae
tracking method e2e test
pasha-codefresh Sep 29, 2021
c63ca0a
Merge pull request #7 from pasha-codefresh/tracking-method-app-id-val…
pasha-codefresh Sep 29, 2021
cc49063
remove redundant log
pasha-codefresh Sep 29, 2021
8b80c38
Merge branch 'tracking-method-app-id-value-convention' of github.com:…
pasha-codefresh Sep 29, 2021
f11f825
fix merge issues
pasha-codefresh Sep 29, 2021
a54be01
fix tests
pasha-codefresh Sep 29, 2021
1a10216
Merge branches 'master' and 'tracking-method-in-app' of github.com:pa…
pasha-codefresh Sep 29, 2021
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: 4 additions & 0 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5041,6 +5041,10 @@
},
"syncPolicy": {
"$ref": "#/definitions/v1alpha1SyncPolicy"
},
"trackingMethod": {
"type": "string",
"title": "TrackingMethod is ability configure way how to track resources on application level"
}
}
},
Expand Down
20 changes: 18 additions & 2 deletions controller/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ func skipAppRequeuing(key kube.ResourceKey) bool {
return ignoredRefreshResources[key.Group+"/"+key.Kind]
}

// Get application name from label first, if it is exist and same as defined tracking method, this app name is taken
// In case if application name can't be retrieve or not same as tracking method inside retrieved app, we do same flow but with annotations
func (c *liveStateCache) retrieveApplicationName(un *unstructured.Unstructured) string {
appNameFromLabels := c.resourceTracking.GetApplicationNameIfResourceBelongApp(un, c.cacheSettings.appInstanceLabelKey, c.appInformer, argo.TrackingMethodLabel)
if appNameFromLabels != "" {
return appNameFromLabels
}
return c.resourceTracking.GetApplicationNameIfResourceBelongApp(un, c.cacheSettings.appInstanceLabelKey, c.appInformer, argo.TrackingMethodAnnotation)
}

func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, error) {
c.lock.RLock()
clusterCache, ok := c.clusters[server]
Expand Down Expand Up @@ -288,7 +298,7 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
return nil, fmt.Errorf("controller is configured to ignore cluster %s", cluster.Server)
}

trackingMethod := argo.GetTrackingMethod(c.settingsMgr)
trackingMethod := argo.GetTrackingMethodFromSettings(c.settingsMgr)

clusterCache = clustercache.NewClusterCache(cluster.RESTConfig(),
clustercache.SetListSemaphore(c.listSemaphore),
Expand All @@ -301,7 +311,13 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
populateNodeInfo(un, res)
res.Health, _ = health.GetResourceHealth(un, cacheSettings.clusterSettings.ResourceHealthOverride)

appName := c.resourceTracking.GetAppName(un, cacheSettings.appInstanceLabelKey, trackingMethod)
appName := c.retrieveApplicationName(un)

// if application not exist in labels and annotations with related tracking method, application should be retrieved with settings level tracking method
if appName == "" {
appName = c.resourceTracking.GetAppName(un, cacheSettings.appInstanceLabelKey, trackingMethod)
}

if isRoot && appName != "" {
res.AppName = appName
}
Expand Down
2 changes: 1 addition & 1 deletion controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1
ApiVersions: argo.APIGroupsToVersions(apiGroups),
VerifySignature: verifySignature,
HelmRepoCreds: permittedHelmCredentials,
TrackingMethod: string(argo.GetTrackingMethod(m.settingsMgr)),
TrackingMethod: string(argo.GetTrackingMethod(m.settingsMgr, app)),
})
if err != nil {
return nil, nil, err
Expand Down
4 changes: 4 additions & 0 deletions manifests/core-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ spec:
type: string
type: array
type: object
trackingMethod:
description: TrackingMethod is ability configure way how to track
resources on application level
type: string
required:
- destination
- project
Expand Down
4 changes: 4 additions & 0 deletions manifests/crds/application-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,10 @@ spec:
type: string
type: array
type: object
trackingMethod:
description: TrackingMethod is ability configure way how to track
resources on application level
type: string
required:
- destination
- project
Expand Down
4 changes: 4 additions & 0 deletions manifests/ha/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ spec:
type: string
type: array
type: object
trackingMethod:
description: TrackingMethod is ability configure way how to track
resources on application level
type: string
required:
- destination
- project
Expand Down
4 changes: 4 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ spec:
type: string
type: array
type: object
trackingMethod:
description: TrackingMethod is ability configure way how to track
resources on application level
type: string
required:
- destination
- project
Expand Down
Loading