Compare commits

...

9 Commits

Author SHA1 Message Date
github-actions[bot]
8a7c0f0c86 Bump version to 3.0.2 on release-3.0 branch (#23039)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-05-19 16:41:34 +03:00
Regina Voloshin
3fb34b99de fix(haproxy): setting maxconn in haproxy config cherry-pick (#15319) (#18283) (#23037)
Signed-off-by: Timothy Griffiths <griffiths.timothy@gmail.com>
Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
Co-authored-by: Timothy Griffiths <griffiths.timothy@gmail.com>
Co-authored-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
2025-05-19 14:48:47 +02:00
Oleksandr Saulyak
90e9d1a5ad fix: settings request doesn't return default tracking method (#22965) (cherry-pick) (#23034)
Signed-off-by: oleksandr-codefresh <oleksandr.saulyak@octopus.com>
2025-05-19 11:07:32 +03:00
gcp-cherry-pick-bot[bot]
cca991a018 fix(test): broken e2e test (cherry-pick #22975) (#23017)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-16 10:00:08 -07:00
gcp-cherry-pick-bot[bot]
3d37cfac04 docs(server): no resource health when using the list api (cherry-pick #22954) (#22972)
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-05-14 11:40:19 -04:00
github-actions[bot]
2bcef48772 Bump version to 3.0.1 on release-3.0 branch (#22968)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <19544836+reggie-k@users.noreply.github.com>
2025-05-14 17:59:45 +03:00
gcp-cherry-pick-bot[bot]
cb5d6f5ef7 fix(health): handle nil lastTransitionTime (#22897) (cherry-pick #22900) (#22908)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-05-09 10:46:00 -04:00
gcp-cherry-pick-bot[bot]
2913d5fcb5 fix: Race condition in nativeGitClient.LsFiles (issue #21754) (cherry-pick #22878) (#22906)
Signed-off-by: Mathieu Agar <magar@mirakl.com>
Co-authored-by: Mathieu Agar <magar@mirakl.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
2025-05-08 08:01:31 -07:00
gcp-cherry-pick-bot[bot]
edd2358f79 fix(docs): upgrading 3.0 docs (cherry-pick #22891) (#22894)
Signed-off-by: Joerg Heyduk <joerg@heyduk.org>
Co-authored-by: jheyduk <jheyduk@users.noreply.github.com>
2025-05-07 09:06:07 -04:00
44 changed files with 407 additions and 201 deletions

View File

@@ -1 +1 @@
3.0.0
3.0.2

View File

@@ -242,6 +242,10 @@ func (c *liveStateCache) loadCacheSettings() (*cacheSettings, error) {
if err != nil {
return nil, err
}
trackingMethod, err := c.settingsMgr.GetTrackingMethod()
if err != nil {
return nil, err
}
installationID, err := c.settingsMgr.GetInstallationID()
if err != nil {
return nil, err
@@ -267,7 +271,7 @@ func (c *liveStateCache) loadCacheSettings() (*cacheSettings, error) {
ResourcesFilter: resourcesFilter,
}
return &cacheSettings{clusterSettings, appInstanceLabelKey, argo.GetTrackingMethod(c.settingsMgr), installationID, resourceUpdatesOverrides, ignoreResourceUpdatesEnabled}, nil
return &cacheSettings{clusterSettings, appInstanceLabelKey, appv1.TrackingMethod(trackingMethod), installationID, resourceUpdatesOverrides, ignoreResourceUpdatesEnabled}, nil
}
func asResourceNode(r *clustercache.Resource) appv1.ResourceNode {

View File

@@ -163,6 +163,11 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
return nil, nil, false, fmt.Errorf("failed to get Helm settings: %w", err)
}
trackingMethod, err := m.settingsMgr.GetTrackingMethod()
if err != nil {
return nil, nil, false, fmt.Errorf("failed to get trackingMethod: %w", err)
}
installationID, err := m.settingsMgr.GetInstallationID()
if err != nil {
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
ApplicationSource: &source,
KubeVersion: serverVersion,
ApiVersions: apiVersions,
TrackingMethod: string(argo.GetTrackingMethod(m.settingsMgr)),
TrackingMethod: trackingMethod,
RefSources: refSources,
HasMultipleSources: app.Spec.HasMultipleSources(),
InstallationID: installationID,
@@ -286,7 +291,7 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
ApiVersions: apiVersions,
VerifySignature: verifySignature,
HelmRepoCreds: permittedHelmCredentials,
TrackingMethod: string(argo.GetTrackingMethod(m.settingsMgr)),
TrackingMethod: trackingMethod,
EnabledSourceTypes: enabledSourceTypes,
HelmOptions: helmOptions,
HasMultipleSources: app.Spec.HasMultipleSources(),
@@ -435,24 +440,28 @@ func normalizeClusterScopeTracking(targetObjs []*unstructured.Unstructured, info
// getComparisonSettings will return the system level settings related to the
// diff/normalization process.
func (m *appStateManager) getComparisonSettings() (string, map[string]v1alpha1.ResourceOverride, *settings.ResourcesFilter, string, error) {
func (m *appStateManager) getComparisonSettings() (string, map[string]v1alpha1.ResourceOverride, *settings.ResourcesFilter, string, string, error) {
resourceOverrides, err := m.settingsMgr.GetResourceOverrides()
if err != nil {
return "", nil, nil, "", err
return "", nil, nil, "", "", err
}
appLabelKey, err := m.settingsMgr.GetAppInstanceLabelKey()
if err != nil {
return "", nil, nil, "", err
return "", nil, nil, "", "", err
}
resFilter, err := m.settingsMgr.GetResourcesFilter()
if err != nil {
return "", nil, nil, "", err
return "", nil, nil, "", "", err
}
installationID, err := m.settingsMgr.GetInstallationID()
if err != nil {
return "", nil, nil, "", err
return "", nil, nil, "", "", err
}
return appLabelKey, resourceOverrides, resFilter, installationID, nil
trackingMethod, err := m.settingsMgr.GetTrackingMethod()
if err != nil {
return "", nil, nil, "", "", err
}
return appLabelKey, resourceOverrides, resFilter, installationID, trackingMethod, nil
}
// verifyGnuPGSignature verifies the result of a GnuPG operation for a given git
@@ -503,7 +512,7 @@ func isManagedNamespace(ns *unstructured.Unstructured, app *v1alpha1.Application
// revision and overrides in the app spec.
func (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) {
ts := stats.NewTimingStats()
appLabelKey, resourceOverrides, resFilter, installationID, err := m.getComparisonSettings()
appLabelKey, resourceOverrides, resFilter, installationID, trackingMethod, err := m.getComparisonSettings()
ts.AddCheckpoint("settings_ms")
@@ -615,10 +624,8 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
infoProvider = &resourceInfoProviderStub{}
}
trackingMethod := argo.GetTrackingMethod(m.settingsMgr)
err = normalizeClusterScopeTracking(targetObjs, infoProvider, func(u *unstructured.Unstructured) error {
return m.resourceTracking.SetAppInstance(u, appLabelKey, app.InstanceName(m.namespace), app.Spec.Destination.Namespace, trackingMethod, installationID)
return m.resourceTracking.SetAppInstance(u, appLabelKey, app.InstanceName(m.namespace), app.Spec.Destination.Namespace, v1alpha1.TrackingMethod(trackingMethod), installationID)
})
if err != nil {
msg := "Failed to normalize cluster-scoped resource tracking: " + err.Error()
@@ -685,7 +692,7 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
for _, liveObj := range liveObjByKey {
if liveObj != nil {
appInstanceName := m.resourceTracking.GetAppName(liveObj, appLabelKey, trackingMethod, installationID)
appInstanceName := m.resourceTracking.GetAppName(liveObj, appLabelKey, v1alpha1.TrackingMethod(trackingMethod), installationID)
if appInstanceName != "" && appInstanceName != app.InstanceName(m.namespace) {
fqInstanceName := strings.ReplaceAll(appInstanceName, "_", "/")
conditions = append(conditions, v1alpha1.ApplicationCondition{
@@ -824,7 +831,7 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
}
gvk := obj.GroupVersionKind()
isSelfReferencedObj := m.isSelfReferencedObj(liveObj, targetObj, app.GetName(), trackingMethod, installationID)
isSelfReferencedObj := m.isSelfReferencedObj(liveObj, targetObj, app.GetName(), v1alpha1.TrackingMethod(trackingMethod), installationID)
resState := v1alpha1.ResourceStatus{
Namespace: obj.GetNamespace(),
@@ -1148,7 +1155,7 @@ func (m *appStateManager) isSelfReferencedObj(live, config *unstructured.Unstruc
// If tracking method doesn't contain required metadata for this check,
// we are not able to determine and just assume the object to be managed.
if trackingMethod == argo.TrackingMethodLabel {
if trackingMethod == v1alpha1.TrackingMethodLabel {
return true
}

View File

@@ -31,7 +31,6 @@ import (
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
"github.com/argoproj/argo-cd/v3/test"
"github.com/argoproj/argo-cd/v3/util/argo"
)
// TestCompareAppStateEmpty tests comparison when both git and live have no objects
@@ -1415,8 +1414,8 @@ func TestIsLiveResourceManaged(t *testing.T) {
configObj := managedObj.DeepCopy()
// then
assert.True(t, manager.isSelfReferencedObj(managedObj, configObj, appName, argo.TrackingMethodLabel, ""))
assert.True(t, manager.isSelfReferencedObj(managedObj, configObj, appName, argo.TrackingMethodAnnotation, ""))
assert.True(t, manager.isSelfReferencedObj(managedObj, configObj, appName, v1alpha1.TrackingMethodLabel, ""))
assert.True(t, manager.isSelfReferencedObj(managedObj, configObj, appName, v1alpha1.TrackingMethodAnnotation, ""))
})
t.Run("will return true if tracked with label", func(t *testing.T) {
// given
@@ -1424,43 +1423,43 @@ func TestIsLiveResourceManaged(t *testing.T) {
configObj := managedObjWithLabel.DeepCopy()
// then
assert.True(t, manager.isSelfReferencedObj(managedObjWithLabel, configObj, appName, argo.TrackingMethodLabel, ""))
assert.True(t, manager.isSelfReferencedObj(managedObjWithLabel, configObj, appName, v1alpha1.TrackingMethodLabel, ""))
})
t.Run("will handle if trackingId has wrong resource name and config is nil", func(t *testing.T) {
// given
t.Parallel()
// then
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongName, nil, appName, argo.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongName, nil, appName, argo.TrackingMethodAnnotation, ""))
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongName, nil, appName, v1alpha1.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongName, nil, appName, v1alpha1.TrackingMethodAnnotation, ""))
})
t.Run("will handle if trackingId has wrong resource group and config is nil", func(t *testing.T) {
// given
t.Parallel()
// then
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongGroup, nil, appName, argo.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongGroup, nil, appName, argo.TrackingMethodAnnotation, ""))
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongGroup, nil, appName, v1alpha1.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongGroup, nil, appName, v1alpha1.TrackingMethodAnnotation, ""))
})
t.Run("will handle if trackingId has wrong kind and config is nil", func(t *testing.T) {
// given
t.Parallel()
// then
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongKind, nil, appName, argo.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongKind, nil, appName, argo.TrackingMethodAnnotation, ""))
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongKind, nil, appName, v1alpha1.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongKind, nil, appName, v1alpha1.TrackingMethodAnnotation, ""))
})
t.Run("will handle if trackingId has wrong namespace and config is nil", func(t *testing.T) {
// given
t.Parallel()
// then
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongNamespace, nil, appName, argo.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongNamespace, nil, appName, argo.TrackingMethodAnnotationAndLabel, ""))
assert.True(t, manager.isSelfReferencedObj(unmanagedObjWrongNamespace, nil, appName, v1alpha1.TrackingMethodLabel, ""))
assert.False(t, manager.isSelfReferencedObj(unmanagedObjWrongNamespace, nil, appName, v1alpha1.TrackingMethodAnnotationAndLabel, ""))
})
t.Run("will return true if live is nil", func(t *testing.T) {
t.Parallel()
assert.True(t, manager.isSelfReferencedObj(nil, nil, appName, argo.TrackingMethodAnnotation, ""))
assert.True(t, manager.isSelfReferencedObj(nil, nil, appName, v1alpha1.TrackingMethodAnnotation, ""))
})
t.Run("will handle upgrade in desired state APIGroup", func(t *testing.T) {
@@ -1470,7 +1469,7 @@ func TestIsLiveResourceManaged(t *testing.T) {
delete(config.GetAnnotations(), common.AnnotationKeyAppInstance)
// then
assert.True(t, manager.isSelfReferencedObj(managedWrongAPIGroup, config, appName, argo.TrackingMethodAnnotation, ""))
assert.True(t, manager.isSelfReferencedObj(managedWrongAPIGroup, config, appName, v1alpha1.TrackingMethodAnnotation, ""))
})
}

View File

@@ -309,7 +309,11 @@ func (m *appStateManager) SyncAppState(app *v1alpha1.Application, state *v1alpha
log.Errorf("Could not get installation ID: %v", err)
return
}
trackingMethod := argo.GetTrackingMethod(m.settingsMgr)
trackingMethod, err := m.settingsMgr.GetTrackingMethod()
if err != nil {
log.Errorf("Could not get trackingMethod: %v", err)
return
}
impersonationEnabled, err := m.settingsMgr.IsImpersonationEnabled()
if err != nil {
@@ -360,7 +364,7 @@ func (m *appStateManager) SyncAppState(app *v1alpha1.Application, state *v1alpha
return (len(syncOp.Resources) == 0 ||
isPostDeleteHook(target) ||
argo.ContainsSyncResource(key.Name, key.Namespace, schema.GroupVersionKind{Kind: key.Kind, Group: key.Group}, syncOp.Resources)) &&
m.isSelfReferencedObj(live, target, app.GetName(), trackingMethod, installationID)
m.isSelfReferencedObj(live, target, app.GetName(), v1alpha1.TrackingMethod(trackingMethod), installationID)
}),
sync.WithManifestValidation(!syncOp.SyncOptions.HasOption(common.SyncOptionsDisableValidation)),
sync.WithSyncWaveHook(delayBetweenSyncWaves),

View File

@@ -373,6 +373,9 @@ kubectl get applications.argoproj.io <my app> -n argocd -o jsonpath='{.status.re
Any tools or CLI commands parsing the `.status.resources[].health` need to be updated to use the argocd cli/API to get the health status.
!!! note
The application list API (argocd app list) no longer returns the individual health status of resources.
```sh
argocd app get <my app> -o json
```
@@ -434,4 +437,4 @@ data:
ignoreResourceStatusField: crd
```
More details for ignored resource updates in the [Diffing customization](../../user-guide/diffing.md) documentation.
More details for ignored resource updates in the [Diffing customization](../../user-guide/diffing.md) documentation.

View File

@@ -5,7 +5,7 @@ kind: Kustomization
images:
- name: quay.io/argoproj/argocd
newName: quay.io/argoproj/argocd
newTag: v3.0.0
newTag: v3.0.2
resources:
- ./application-controller
- ./dex

View File

@@ -24609,7 +24609,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -24885,7 +24885,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -25158,7 +25158,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -25210,7 +25210,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -25540,7 +25540,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -24577,7 +24577,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -24697,7 +24697,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -24970,7 +24970,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -25022,7 +25022,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -25352,7 +25352,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -12,4 +12,4 @@ resources:
images:
- name: quay.io/argoproj/argocd
newName: quay.io/argoproj/argocd
newTag: v3.0.0
newTag: v3.0.2

View File

@@ -12,7 +12,7 @@ patches:
images:
- name: quay.io/argoproj/argocd
newName: quay.io/argoproj/argocd
newTag: v3.0.0
newTag: v3.0.2
resources:
- ../../base/application-controller
- ../../base/applicationset-controller

View File

@@ -701,6 +701,10 @@ data:
stats enable
stats uri /stats
stats refresh 10s
# Additional configuration
global
maxconn 4096
haproxy_init.sh: |
HAPROXY_CONF=/data/haproxy.cfg
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
@@ -1092,7 +1096,7 @@ spec:
prometheus.io/port: "9101"
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
checksum/config: e34e8124c38bcfd2f16e75620bbde30158686692b13bc449eecc44c51b207d54
checksum/config: cd6508bdf9819601c454d0cc491fb77a209e3a88761d92514d105b6681829953
spec:
# Needed when using unmodified rbac-setup.yml

View File

@@ -21,6 +21,9 @@ redis-ha:
checkInterval: 3s
metrics:
enabled: true
extraConfig: |
global
maxconn 4096
serviceAccount:
automountToken: true
image:

View File

@@ -25039,7 +25039,8 @@ data:
1\n use-server R2 if { srv_is_up(R2) } { nbsrv(check_if_redis_is_master_2) ge
2 }\n server R2 argocd-redis-ha-announce-2:6379 check inter 3s fall 1 rise 1\nfrontend
stats\n mode http\n bind :9101 \n http-request use-service prometheus-exporter
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n"
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n#
Additional configuration\nglobal\n maxconn 4096\n"
haproxy_init.sh: |
HAPROXY_CONF=/data/haproxy.cfg
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
@@ -25974,7 +25975,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -26273,7 +26274,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -26369,7 +26370,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -26429,7 +26430,7 @@ spec:
template:
metadata:
annotations:
checksum/config: e34e8124c38bcfd2f16e75620bbde30158686692b13bc449eecc44c51b207d54
checksum/config: cd6508bdf9819601c454d0cc491fb77a209e3a88761d92514d105b6681829953
prometheus.io/path: /metrics
prometheus.io/port: "9101"
prometheus.io/scrape: "true"
@@ -26493,7 +26494,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -26792,7 +26793,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -26844,7 +26845,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -27218,7 +27219,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -27584,7 +27585,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -25030,7 +25030,8 @@ data:
1\n use-server R2 if { srv_is_up(R2) } { nbsrv(check_if_redis_is_master_2) ge
2 }\n server R2 argocd-redis-ha-announce-2:6379 check inter 3s fall 1 rise 1\nfrontend
stats\n mode http\n bind :9101 \n http-request use-service prometheus-exporter
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n"
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n#
Additional configuration\nglobal\n maxconn 4096\n"
haproxy_init.sh: |
HAPROXY_CONF=/data/haproxy.cfg
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
@@ -25944,7 +25945,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -26087,7 +26088,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -26183,7 +26184,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -26243,7 +26244,7 @@ spec:
template:
metadata:
annotations:
checksum/config: e34e8124c38bcfd2f16e75620bbde30158686692b13bc449eecc44c51b207d54
checksum/config: cd6508bdf9819601c454d0cc491fb77a209e3a88761d92514d105b6681829953
prometheus.io/path: /metrics
prometheus.io/port: "9101"
prometheus.io/scrape: "true"
@@ -26307,7 +26308,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -26606,7 +26607,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -26658,7 +26659,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -27032,7 +27033,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -27398,7 +27399,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -926,7 +926,8 @@ data:
1\n use-server R2 if { srv_is_up(R2) } { nbsrv(check_if_redis_is_master_2) ge
2 }\n server R2 argocd-redis-ha-announce-2:6379 check inter 3s fall 1 rise 1\nfrontend
stats\n mode http\n bind :9101 \n http-request use-service prometheus-exporter
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n"
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n#
Additional configuration\nglobal\n maxconn 4096\n"
haproxy_init.sh: |
HAPROXY_CONF=/data/haproxy.cfg
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
@@ -1861,7 +1862,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -2160,7 +2161,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -2256,7 +2257,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -2316,7 +2317,7 @@ spec:
template:
metadata:
annotations:
checksum/config: e34e8124c38bcfd2f16e75620bbde30158686692b13bc449eecc44c51b207d54
checksum/config: cd6508bdf9819601c454d0cc491fb77a209e3a88761d92514d105b6681829953
prometheus.io/path: /metrics
prometheus.io/port: "9101"
prometheus.io/scrape: "true"
@@ -2380,7 +2381,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -2679,7 +2680,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -2731,7 +2732,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -3105,7 +3106,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -3471,7 +3472,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -917,7 +917,8 @@ data:
1\n use-server R2 if { srv_is_up(R2) } { nbsrv(check_if_redis_is_master_2) ge
2 }\n server R2 argocd-redis-ha-announce-2:6379 check inter 3s fall 1 rise 1\nfrontend
stats\n mode http\n bind :9101 \n http-request use-service prometheus-exporter
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n"
if { path /metrics }\n stats enable\n stats uri /stats\n stats refresh 10s\n#
Additional configuration\nglobal\n maxconn 4096\n"
haproxy_init.sh: |
HAPROXY_CONF=/data/haproxy.cfg
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
@@ -1831,7 +1832,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -1974,7 +1975,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -2070,7 +2071,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -2130,7 +2131,7 @@ spec:
template:
metadata:
annotations:
checksum/config: e34e8124c38bcfd2f16e75620bbde30158686692b13bc449eecc44c51b207d54
checksum/config: cd6508bdf9819601c454d0cc491fb77a209e3a88761d92514d105b6681829953
prometheus.io/path: /metrics
prometheus.io/port: "9101"
prometheus.io/scrape: "true"
@@ -2194,7 +2195,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -2493,7 +2494,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -2545,7 +2546,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -2919,7 +2920,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -3285,7 +3286,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -25069,7 +25069,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -25368,7 +25368,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -25464,7 +25464,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -25566,7 +25566,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -25839,7 +25839,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -25891,7 +25891,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -26263,7 +26263,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -26629,7 +26629,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

16
manifests/install.yaml generated
View File

@@ -25037,7 +25037,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -25180,7 +25180,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -25276,7 +25276,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -25378,7 +25378,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -25651,7 +25651,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -25703,7 +25703,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -26075,7 +26075,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -26441,7 +26441,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -956,7 +956,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -1255,7 +1255,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -1351,7 +1351,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -1453,7 +1453,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -1726,7 +1726,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -1778,7 +1778,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -2150,7 +2150,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -2516,7 +2516,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -924,7 +924,7 @@ spec:
key: applicationsetcontroller.requeue.after
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-applicationset-controller
ports:
@@ -1067,7 +1067,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /shared/argocd-dex
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: copyutil
securityContext:
@@ -1163,7 +1163,7 @@ spec:
key: notificationscontroller.repo.server.plaintext
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
tcpSocket:
@@ -1265,7 +1265,7 @@ spec:
- argocd
- admin
- redis-initial-password
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: IfNotPresent
name: secret-init
securityContext:
@@ -1538,7 +1538,7 @@ spec:
value: /helm-working-dir
- name: HELM_DATA_HOME
value: /helm-working-dir
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
@@ -1590,7 +1590,7 @@ spec:
- -n
- /usr/local/bin/argocd
- /var/run/argocd/argocd-cmp-server
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
name: copyutil
securityContext:
allowPrivilegeEscalation: false
@@ -1962,7 +1962,7 @@ spec:
key: server.sync.replace.allowed
name: argocd-cmd-params-cm
optional: true
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
livenessProbe:
httpGet:
@@ -2328,7 +2328,7 @@ spec:
optional: true
- name: KUBECACHEDIR
value: /tmp/kubecache
image: quay.io/argoproj/argocd:v3.0.0
image: quay.io/argoproj/argocd:v3.0.2
imagePullPolicy: Always
name: argocd-application-controller
ports:

View File

@@ -130,6 +130,7 @@ nav:
- operator-manual/server-commands/additional-configuration-method.md
- Upgrading:
- operator-manual/upgrading/overview.md
- operator-manual/upgrading/2.14-3.0.md
- operator-manual/upgrading/2.13-2.14.md
- operator-manual/upgrading/2.12-2.13.md
- operator-manual/upgrading/2.11-2.12.md

View File

@@ -102,6 +102,12 @@ func (id IgnoreDifferences) Equals(other IgnoreDifferences) bool {
type TrackingMethod string
const (
TrackingMethodAnnotation TrackingMethod = "annotation"
TrackingMethodLabel TrackingMethod = "label"
TrackingMethodAnnotationAndLabel TrackingMethod = "annotation+label"
)
// ResourceIgnoreDifferences contains resource filter and list of json paths which should be ignored during comparison with live state.
type ResourceIgnoreDifferences struct {
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`

View File

@@ -18,7 +18,6 @@ import (
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
"github.com/argoproj/argo-cd/v3/util/argo"
cacheutil "github.com/argoproj/argo-cd/v3/util/cache"
"github.com/argoproj/argo-cd/v3/util/env"
"github.com/argoproj/argo-cd/v3/util/hash"
@@ -305,7 +304,7 @@ func manifestCacheKey(revision string, appSrc *appv1.ApplicationSource, srcRefs
func trackingKey(appLabelKey string, trackingMethod string) string {
trackingKey := appLabelKey
if text.FirstNonEmpty(trackingMethod, string(argo.TrackingMethodLabel)) != string(argo.TrackingMethodLabel) {
if text.FirstNonEmpty(trackingMethod, string(appv1.TrackingMethodLabel)) != string(appv1.TrackingMethodLabel) {
trackingKey = trackingMethod + ":" + trackingKey
}
return trackingKey
@@ -399,7 +398,7 @@ func (c *Cache) DeleteManifests(revision string, appSrc *appv1.ApplicationSource
func appDetailsCacheKey(revision string, appSrc *appv1.ApplicationSource, srcRefs appv1.RefTargetRevisionMapping, trackingMethod appv1.TrackingMethod, refSourceCommitSHAs ResolvedRevisions) string {
if trackingMethod == "" {
trackingMethod = argo.TrackingMethodLabel
trackingMethod = appv1.TrackingMethodLabel
}
return fmt.Sprintf("appdetails|%s|%d|%s", revision, appSourceKey(appSrc, srcRefs, refSourceCommitSHAs), trackingMethod)
}

View File

@@ -7,8 +7,18 @@ if obj.status == nil or obj.status.conditions == nil then
end
-- Sort conditions by lastTransitionTime, from old to new.
-- Ensure that conditions with nil lastTransitionTime are always sorted after those with non-nil values.
table.sort(obj.status.conditions, function(a, b)
return a.lastTransitionTime < b.lastTransitionTime
-- Nil values are considered "less than" non-nil values.
-- This means that conditions with nil lastTransitionTime will be sorted to the end.
if a.lastTransitionTime == nil then
return false
elseif b.lastTransitionTime == nil then
return true
else
-- If both have non-nil lastTransitionTime, compare them normally.
return a.lastTransitionTime < b.lastTransitionTime
end
end)
for _, condition in ipairs(obj.status.conditions) do

View File

@@ -14,4 +14,8 @@ tests:
- healthStatus:
status: Degraded
message: "Has Errors: Waiting for foo/keycloak-1 due to CrashLoopBackOff: back-off 10s"
inputPath: testdata/degraded.yaml
inputPath: testdata/degraded.yaml
- healthStatus:
status: Healthy
message: ""
inputPath: testdata/nil_last_transition_time.yaml

View File

@@ -0,0 +1,13 @@
apiVersion: k8s.keycloak.org/v1alpha1
kind: Keycloak
metadata:
name: keycloak-23
namespace: keycloak
status:
conditions:
- type: Ready
status: "True"
lastTransitionTime: "2025-05-06T12:00:00Z" # Non-nil lastTransitionTime
- type: HasErrors
status: "False"
lastTransitionTime: null # Nil lastTransitionTime

View File

@@ -528,6 +528,10 @@ func (s *Server) GetManifests(ctx context.Context, q *application.ApplicationMan
if err != nil {
return fmt.Errorf("error getting installation ID: %w", err)
}
trackingMethod, err := s.settingsMgr.GetTrackingMethod()
if err != nil {
return fmt.Errorf("error getting trackingMethod from settings: %w", err)
}
manifestInfo, err := client.GenerateManifest(ctx, &apiclient.ManifestRequest{
Repo: repo,
@@ -542,7 +546,7 @@ func (s *Server) GetManifests(ctx context.Context, q *application.ApplicationMan
ApiVersions: argo.APIResourcesToStrings(apiResources, true),
HelmRepoCreds: helmCreds,
HelmOptions: helmOptions,
TrackingMethod: string(argo.GetTrackingMethod(s.settingsMgr)),
TrackingMethod: trackingMethod,
EnabledSourceTypes: enableGenerateManifests,
ProjectName: proj.Name,
ProjectSourceRepos: proj.Spec.SourceRepos,
@@ -613,6 +617,11 @@ func (s *Server) GetManifestsWithFiles(stream application.ApplicationService_Get
return fmt.Errorf("error getting app instance label key from settings: %w", err)
}
trackingMethod, err := s.settingsMgr.GetTrackingMethod()
if err != nil {
return fmt.Errorf("error getting trackingMethod from settings: %w", err)
}
config, err := s.getApplicationClusterConfig(ctx, a)
if err != nil {
return fmt.Errorf("error getting application cluster config: %w", err)
@@ -662,7 +671,7 @@ func (s *Server) GetManifestsWithFiles(stream application.ApplicationService_Get
ApiVersions: argo.APIResourcesToStrings(apiResources, true),
HelmRepoCreds: helmCreds,
HelmOptions: helmOptions,
TrackingMethod: string(argo.GetTrackingMethod(s.settingsMgr)),
TrackingMethod: trackingMethod,
EnabledSourceTypes: enableGenerateManifests,
ProjectName: proj.Name,
ProjectSourceRepos: proj.Spec.SourceRepos,
@@ -777,6 +786,10 @@ func (s *Server) Get(ctx context.Context, q *application.ApplicationQuery) (*v1a
if err != nil {
return fmt.Errorf("error getting kustomize settings: %w", err)
}
trackingMethod, err := s.settingsMgr.GetTrackingMethod()
if err != nil {
return fmt.Errorf("error getting trackingMethod from settings: %w", err)
}
kustomizeOptions, err := kustomizeSettings.GetOptions(a.Spec.GetSource())
if err != nil {
return fmt.Errorf("error getting kustomize settings options: %w", err)
@@ -788,7 +801,7 @@ func (s *Server) Get(ctx context.Context, q *application.ApplicationQuery) (*v1a
KustomizeOptions: kustomizeOptions,
Repos: helmRepos,
NoCache: true,
TrackingMethod: string(argo.GetTrackingMethod(s.settingsMgr)),
TrackingMethod: trackingMethod,
EnabledSourceTypes: enabledSourceTypes,
HelmOptions: helmOptions,
})

View File

@@ -1009,7 +1009,7 @@ func TestDuplicatedClusterResourcesAnnotationTracking(t *testing.T) {
// (i.e. resources where metadata.namespace is set). Before the bugfix, this test would fail with a diff in the
// tracking annotation.
Given(t).
SetTrackingMethod(string(argo.TrackingMethodAnnotation)).
SetTrackingMethod(string(TrackingMethodAnnotation)).
Path("duplicated-resources").
When().
CreateApp().
@@ -2600,7 +2600,7 @@ func TestSwitchTrackingMethod(t *testing.T) {
ctx := Given(t)
ctx.
SetTrackingMethod(string(argo.TrackingMethodAnnotation)).
SetTrackingMethod(string(TrackingMethodAnnotation)).
Path("deployment").
When().
CreateApp().
@@ -2637,7 +2637,7 @@ func TestSwitchTrackingMethod(t *testing.T) {
Expect(SyncStatusIs(SyncStatusCodeSynced)).
Expect(HealthIs(health.HealthStatusHealthy)).
When().
SetTrackingMethod(string(argo.TrackingMethodLabel)).
SetTrackingMethod(string(TrackingMethodLabel)).
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
@@ -2692,7 +2692,7 @@ func TestSwitchTrackingMethod(t *testing.T) {
func TestSwitchTrackingLabel(t *testing.T) {
ctx := Given(t)
require.NoError(t, fixture.SetTrackingMethod(string(argo.TrackingMethodLabel)))
require.NoError(t, fixture.SetTrackingMethod(string(TrackingMethodLabel)))
ctx.
Path("deployment").
When().
@@ -2786,7 +2786,7 @@ func TestSwitchTrackingLabel(t *testing.T) {
func TestAnnotationTrackingExtraResources(t *testing.T) {
ctx := Given(t)
require.NoError(t, fixture.SetTrackingMethod(string(argo.TrackingMethodAnnotation)))
require.NoError(t, fixture.SetTrackingMethod(string(TrackingMethodAnnotation)))
ctx.
Path("deployment").
When().
@@ -2952,7 +2952,7 @@ data:
func TestInstallationID(t *testing.T) {
ctx := Given(t)
ctx.
SetTrackingMethod(string(argo.TrackingMethodAnnotation)).
SetTrackingMethod(string(TrackingMethodAnnotation)).
And(func() {
_, err := fixture.KubeClientset.CoreV1().ConfigMaps(fixture.DeploymentNamespace()).Create(
t.Context(), &corev1.ConfigMap{

View File

@@ -65,7 +65,7 @@ func TestMultiSourceAppWithHelmExternalValueFiles(t *testing.T) {
RepoURL: RepoURL(RepoURLTypeFile),
Ref: "values",
}, {
RepoURL: "https://github.com/argoproj/argocd-example-apps.git",
RepoURL: RepoURL(RepoURLTypeFile),
TargetRevision: "HEAD",
Path: "helm-guestbook",
Helm: &ApplicationSourceHelm{
@@ -107,9 +107,13 @@ func TestMultiSourceAppWithHelmExternalValueFiles(t *testing.T) {
for _, r := range app.Status.Resources {
statusByName[r.Name] = r.Status
}
// check if the app has 3 resources, guestbook and 2 pods
assert.Len(t, statusByName, 1)
assert.Equal(t, SyncStatusCodeSynced, statusByName["helm-guestbook"])
assert.Equal(t, SyncStatusCodeSynced, statusByName["guestbook-ui"])
// Confirm that the deployment has 3 replicas.
output, err := Run("", "kubectl", "get", "deployment", "guestbook-ui", "-n", DeploymentNamespace(), "-o", "jsonpath={.spec.replicas}")
require.NoError(t, err)
assert.Equal(t, "3", output, "Expected 3 replicas for the helm-guestbook deployment")
})
}

View File

@@ -11,7 +11,6 @@ import (
. "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
. "github.com/argoproj/argo-cd/v3/test/e2e/fixture"
. "github.com/argoproj/argo-cd/v3/test/e2e/fixture/app"
"github.com/argoproj/argo-cd/v3/util/argo"
)
func TestClusterRoleBinding(t *testing.T) {
@@ -30,7 +29,7 @@ func TestClusterRoleBinding(t *testing.T) {
assert.Empty(t, diffOutput)
}).
When().
SetTrackingMethod(string(argo.TrackingMethodAnnotation)).
SetTrackingMethod(string(TrackingMethodAnnotation)).
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).

View File

@@ -18,7 +18,6 @@ import (
"k8s.io/client-go/tools/clientcmd"
"github.com/argoproj/argo-cd/v3/common"
"github.com/argoproj/argo-cd/v3/util/argo"
"github.com/argoproj/argo-cd/v3/util/clusterauth"
"github.com/argoproj/gitops-engine/pkg/health"
@@ -54,7 +53,7 @@ func TestDeployment(t *testing.T) {
func TestDeploymentWithAnnotationTrackingMode(t *testing.T) {
ctx := Given(t)
require.NoError(t, SetTrackingMethod(string(argo.TrackingMethodAnnotation)))
require.NoError(t, SetTrackingMethod(string(TrackingMethodAnnotation)))
ctx.
Path("deployment").
When().
@@ -77,7 +76,7 @@ func TestDeploymentWithAnnotationTrackingMode(t *testing.T) {
func TestDeploymentWithLabelTrackingMode(t *testing.T) {
ctx := Given(t)
require.NoError(t, SetTrackingMethod(string(argo.TrackingMethodLabel)))
require.NoError(t, SetTrackingMethod(string(TrackingMethodLabel)))
ctx.
Path("deployment").
When().

View File

@@ -11,7 +11,6 @@ import (
"github.com/argoproj/argo-cd/v3/test/e2e/fixture/certs"
"github.com/argoproj/argo-cd/v3/test/e2e/fixture/gpgkeys"
"github.com/argoproj/argo-cd/v3/test/e2e/fixture/repos"
"github.com/argoproj/argo-cd/v3/util/argo"
"github.com/argoproj/argo-cd/v3/util/env"
"github.com/argoproj/argo-cd/v3/util/settings"
)
@@ -88,7 +87,7 @@ func GivenWithSameState(t *testing.T) *Context {
timeout: timeout,
project: "default",
prune: true,
trackingMethod: argo.TrackingMethodLabel,
trackingMethod: v1alpha1.TrackingMethodLabel,
}
}

View File

@@ -0,0 +1,3 @@
apiVersion: v2
version: 1.0.0
name: helm-guestbook

View File

@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: guestbook-ui
labels:
test: "true"
spec:
replicas: {{ .Values.replicas }}
revisionHistoryLimit: 3
selector:
matchLabels:
app: guestbook-ui
template:
metadata:
labels:
app: guestbook-ui
spec:
containers:
- image: quay.io/argoprojlabs/argocd-e2e-container:0.2
imagePullPolicy: IfNotPresent
name: guestbook-ui
ports:
- containerPort: 80

View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: guestbook-ui
spec:
ports:
- port: 80
targetPort: 80
selector:
app: guestbook-ui

View File

@@ -0,0 +1 @@
replicas: 1

View File

@@ -773,6 +773,15 @@ func verifyGenerateManifests(
continue
}
trackingMethod, err := settingsMgr.GetTrackingMethod()
if err != nil {
conditions = append(conditions, argoappv1.ApplicationCondition{
Type: argoappv1.ApplicationConditionInvalidSpecError,
Message: fmt.Sprintf("Error getting trackingMethod: %v", err),
})
continue
}
verifySignature := false
if len(proj.Spec.SignatureKeys) > 0 && gpg.IsGPGEnabled() {
verifySignature = true
@@ -798,7 +807,7 @@ func verifyGenerateManifests(
ApiVersions: apiVersions,
HelmOptions: helmOptions,
HelmRepoCreds: repositoryCredentials,
TrackingMethod: string(GetTrackingMethod(settingsMgr)),
TrackingMethod: trackingMethod,
EnabledSourceTypes: enableGenerateManifests,
NoRevisionCache: true,
HasMultipleSources: app.Spec.HasMultipleSources(),

View File

@@ -12,13 +12,6 @@ import (
"github.com/argoproj/argo-cd/v3/common"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v3/util/kube"
"github.com/argoproj/argo-cd/v3/util/settings"
)
const (
TrackingMethodAnnotation v1alpha1.TrackingMethod = "annotation"
TrackingMethodLabel v1alpha1.TrackingMethod = "label"
TrackingMethodAnnotationAndLabel v1alpha1.TrackingMethod = "annotation+label"
)
var (
@@ -52,17 +45,8 @@ func NewResourceTracking() ResourceTracking {
return &resourceTracking{}
}
// GetTrackingMethod retrieve tracking method from settings
func GetTrackingMethod(settingsMgr *settings.SettingsManager) v1alpha1.TrackingMethod {
tm, err := settingsMgr.GetTrackingMethod()
if err != nil || tm == "" {
return TrackingMethodAnnotation
}
return v1alpha1.TrackingMethod(tm)
}
func IsOldTrackingMethod(trackingMethod string) bool {
return trackingMethod == "" || trackingMethod == string(TrackingMethodLabel)
return trackingMethod == "" || trackingMethod == string(v1alpha1.TrackingMethodLabel)
}
func (rt *resourceTracking) getAppInstanceValue(un *unstructured.Unstructured, installationID string) *AppInstanceValue {
@@ -90,15 +74,15 @@ func (rt *resourceTracking) GetAppName(un *unstructured.Unstructured, key string
return ""
}
switch trackingMethod {
case TrackingMethodLabel:
case v1alpha1.TrackingMethodLabel:
label, err := kube.GetAppInstanceLabel(un, key)
if err != nil {
return ""
}
return label
case TrackingMethodAnnotationAndLabel:
case v1alpha1.TrackingMethodAnnotationAndLabel:
return retrieveAppInstanceValue()
case TrackingMethodAnnotation:
case v1alpha1.TrackingMethodAnnotation:
return retrieveAppInstanceValue()
default:
return retrieveAppInstanceValue()
@@ -110,7 +94,7 @@ func (rt *resourceTracking) GetAppName(un *unstructured.Unstructured, key string
// not be parsed, it returns nil.
func (rt *resourceTracking) GetAppInstance(un *unstructured.Unstructured, trackingMethod v1alpha1.TrackingMethod, instanceID string) *AppInstanceValue {
switch trackingMethod {
case TrackingMethodAnnotation, TrackingMethodAnnotationAndLabel:
case v1alpha1.TrackingMethodAnnotation, v1alpha1.TrackingMethodAnnotationAndLabel:
return rt.getAppInstanceValue(un, instanceID)
default:
return nil
@@ -152,15 +136,15 @@ func (rt *resourceTracking) SetAppInstance(un *unstructured.Unstructured, key, v
return kube.SetAppInstanceAnnotation(un, common.AnnotationKeyAppInstance, rt.BuildAppInstanceValue(appInstanceValue))
}
switch trackingMethod {
case TrackingMethodLabel:
case v1alpha1.TrackingMethodLabel:
err := kube.SetAppInstanceLabel(un, key, val)
if err != nil {
return fmt.Errorf("failed to set app instance label: %w", err)
}
return nil
case TrackingMethodAnnotation:
case v1alpha1.TrackingMethodAnnotation:
return setAppInstanceAnnotation()
case TrackingMethodAnnotationAndLabel:
case v1alpha1.TrackingMethodAnnotationAndLabel:
err := setAppInstanceAnnotation()
if err != nil {
return err

View File

@@ -12,6 +12,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"github.com/argoproj/argo-cd/v3/common"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
)
func TestSetAppInstanceLabel(t *testing.T) {
@@ -24,9 +25,9 @@ func TestSetAppInstanceLabel(t *testing.T) {
resourceTracking := NewResourceTracking()
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app", "", TrackingMethodLabel, "")
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app", "", v1alpha1.TrackingMethodLabel, "")
require.NoError(t, err)
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodLabel, "")
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, v1alpha1.TrackingMethodLabel, "")
assert.Equal(t, "my-app", app)
}
@@ -40,10 +41,10 @@ func TestSetAppInstanceAnnotation(t *testing.T) {
resourceTracking := NewResourceTracking()
err = resourceTracking.SetAppInstance(&obj, common.AnnotationKeyAppInstance, "my-app", "", TrackingMethodAnnotation, "")
err = resourceTracking.SetAppInstance(&obj, common.AnnotationKeyAppInstance, "my-app", "", v1alpha1.TrackingMethodAnnotation, "")
require.NoError(t, err)
app := resourceTracking.GetAppName(&obj, common.AnnotationKeyAppInstance, TrackingMethodAnnotation, "")
app := resourceTracking.GetAppName(&obj, common.AnnotationKeyAppInstance, v1alpha1.TrackingMethodAnnotation, "")
assert.Equal(t, "my-app", app)
}
@@ -56,10 +57,10 @@ func TestSetAppInstanceAnnotationAndLabel(t *testing.T) {
resourceTracking := NewResourceTracking()
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app", "", TrackingMethodAnnotationAndLabel, "")
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app", "", v1alpha1.TrackingMethodAnnotationAndLabel, "")
require.NoError(t, err)
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodAnnotationAndLabel, "")
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, v1alpha1.TrackingMethodAnnotationAndLabel, "")
assert.Equal(t, "my-app", app)
}
@@ -72,11 +73,11 @@ func TestSetAppInstanceAnnotationAndLabelLongName(t *testing.T) {
resourceTracking := NewResourceTracking()
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app-with-an-extremely-long-name-that-is-over-sixty-three-characters", "", TrackingMethodAnnotationAndLabel, "")
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "my-app-with-an-extremely-long-name-that-is-over-sixty-three-characters", "", v1alpha1.TrackingMethodAnnotationAndLabel, "")
require.NoError(t, err)
// the annotation should still work, so the name from GetAppName should not be truncated
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodAnnotationAndLabel, "")
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, v1alpha1.TrackingMethodAnnotationAndLabel, "")
assert.Equal(t, "my-app-with-an-extremely-long-name-that-is-over-sixty-three-characters", app)
// the label should be truncated to 63 characters
@@ -92,11 +93,11 @@ func TestSetAppInstanceAnnotationAndLabelLongNameBadEnding(t *testing.T) {
resourceTracking := NewResourceTracking()
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "the-very-suspicious-name-with-precisely-sixty-three-characters-with-hyphen", "", TrackingMethodAnnotationAndLabel, "")
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "the-very-suspicious-name-with-precisely-sixty-three-characters-with-hyphen", "", v1alpha1.TrackingMethodAnnotationAndLabel, "")
require.NoError(t, err)
// the annotation should still work, so the name from GetAppName should not be truncated
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodAnnotationAndLabel, "")
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, v1alpha1.TrackingMethodAnnotationAndLabel, "")
assert.Equal(t, "the-very-suspicious-name-with-precisely-sixty-three-characters-with-hyphen", app)
// the label should be truncated to 63 characters, AND the hyphen should be removed
@@ -112,7 +113,7 @@ func TestSetAppInstanceAnnotationAndLabelOutOfBounds(t *testing.T) {
resourceTracking := NewResourceTracking()
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "----------------------------------------------------------------", "", TrackingMethodAnnotationAndLabel, "")
err = resourceTracking.SetAppInstance(&obj, common.LabelKeyAppInstance, "----------------------------------------------------------------", "", v1alpha1.TrackingMethodAnnotationAndLabel, "")
// this should error because it can't truncate to a valid value
assert.EqualError(t, err, "failed to set app instance label: unable to truncate label to not end with a special character")
}
@@ -127,7 +128,7 @@ func TestSetAppInstanceAnnotationNotFound(t *testing.T) {
resourceTracking := NewResourceTracking()
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, TrackingMethodAnnotation, "")
app := resourceTracking.GetAppName(&obj, common.LabelKeyAppInstance, v1alpha1.TrackingMethodAnnotation, "")
assert.Equal(t, "", app)
}
@@ -186,15 +187,15 @@ func TestResourceIdNormalizer_Normalize(t *testing.T) {
// live object is a resource that has old style tracking label
liveObj := sampleResource(t)
err := rt.SetAppInstance(liveObj, common.LabelKeyAppInstance, "my-app", "", TrackingMethodLabel, "")
err := rt.SetAppInstance(liveObj, common.LabelKeyAppInstance, "my-app", "", v1alpha1.TrackingMethodLabel, "")
require.NoError(t, err)
// config object is a resource that has new style tracking annotation
configObj := sampleResource(t)
err = rt.SetAppInstance(configObj, common.AnnotationKeyAppInstance, "my-app2", "", TrackingMethodAnnotation, "")
err = rt.SetAppInstance(configObj, common.AnnotationKeyAppInstance, "my-app2", "", v1alpha1.TrackingMethodAnnotation, "")
require.NoError(t, err)
_ = rt.Normalize(configObj, liveObj, common.LabelKeyAppInstance, string(TrackingMethodAnnotation))
_ = rt.Normalize(configObj, liveObj, common.LabelKeyAppInstance, string(v1alpha1.TrackingMethodAnnotation))
// the normalization should affect add the new style annotation and drop old tracking label from live object
annotation, err := kube.GetAppInstanceAnnotation(configObj, common.AnnotationKeyAppInstance)
@@ -243,7 +244,7 @@ func TestResourceIdNormalizer_NormalizeCRD(t *testing.T) {
},
}
require.NoError(t, rt.Normalize(configObj, liveObj, common.LabelKeyAppInstance, string(TrackingMethodAnnotation)))
require.NoError(t, rt.Normalize(configObj, liveObj, common.LabelKeyAppInstance, string(v1alpha1.TrackingMethodAnnotation)))
// the normalization should not apply any changes to the live object
require.NotContains(t, liveObj.GetAnnotations(), common.AnnotationKeyAppInstance)
}
@@ -253,17 +254,17 @@ func TestResourceIdNormalizer_Normalize_ConfigHasOldLabel(t *testing.T) {
// live object is a resource that has old style tracking label
liveObj := sampleResource(t)
err := rt.SetAppInstance(liveObj, common.LabelKeyAppInstance, "my-app", "", TrackingMethodLabel, "")
err := rt.SetAppInstance(liveObj, common.LabelKeyAppInstance, "my-app", "", v1alpha1.TrackingMethodLabel, "")
require.NoError(t, err)
// config object is a resource that has new style tracking annotation
configObj := sampleResource(t)
err = rt.SetAppInstance(configObj, common.AnnotationKeyAppInstance, "my-app2", "", TrackingMethodAnnotation, "")
err = rt.SetAppInstance(configObj, common.AnnotationKeyAppInstance, "my-app2", "", v1alpha1.TrackingMethodAnnotation, "")
require.NoError(t, err)
err = rt.SetAppInstance(configObj, common.LabelKeyAppInstance, "my-app", "", TrackingMethodLabel, "")
err = rt.SetAppInstance(configObj, common.LabelKeyAppInstance, "my-app", "", v1alpha1.TrackingMethodLabel, "")
require.NoError(t, err)
_ = rt.Normalize(configObj, liveObj, common.LabelKeyAppInstance, string(TrackingMethodAnnotation))
_ = rt.Normalize(configObj, liveObj, common.LabelKeyAppInstance, string(v1alpha1.TrackingMethodAnnotation))
// the normalization should affect add the new style annotation and drop old tracking label from live object
annotation, err := kube.GetAppInstanceAnnotation(configObj, common.AnnotationKeyAppInstance)
@@ -274,5 +275,5 @@ func TestResourceIdNormalizer_Normalize_ConfigHasOldLabel(t *testing.T) {
}
func TestIsOldTrackingMethod(t *testing.T) {
assert.True(t, IsOldTrackingMethod(string(TrackingMethodLabel)))
assert.True(t, IsOldTrackingMethod(string(v1alpha1.TrackingMethodLabel)))
}

View File

@@ -424,11 +424,14 @@ func (m *nativeGitClient) Fetch(revision string) error {
func (m *nativeGitClient) LsFiles(path string, enableNewGitFileGlobbing bool) ([]string, error) {
if enableNewGitFileGlobbing {
// This is the new way with safer globbing
err := os.Chdir(m.root)
// evaluating the root path for symlinks
realRoot, err := filepath.EvalSymlinks(m.root)
if err != nil {
return nil, err
}
allFiles, err := doublestar.FilepathGlob(path)
// searching for the pattern inside the root path
allFiles, err := doublestar.FilepathGlob(filepath.Join(realRoot, path))
if err != nil {
return nil, err
}
@@ -442,10 +445,16 @@ func (m *nativeGitClient) LsFiles(path string, enableNewGitFileGlobbing bool) ([
if err != nil {
return nil, err
}
if strings.HasPrefix(absPath, m.root) {
files = append(files, file)
if strings.HasPrefix(absPath, realRoot) {
// removing the repository root prefix from the file path
relativeFile, err := filepath.Rel(realRoot, file)
if err != nil {
return nil, err
}
files = append(files, relativeFile)
} else {
log.Warnf("Absolute path for %s is outside of repository, removing it", file)
log.Warnf("Absolute path for %s is outside of repository, ignoring it", file)
}
}
return files, nil

View File

@@ -9,6 +9,7 @@ import (
"path"
"path/filepath"
"strings"
"sync"
"testing"
"time"
@@ -979,6 +980,65 @@ func Test_nativeGitClient_runCredentialedCmd(t *testing.T) {
}
}
func Test_LsFiles_RaceCondition(t *testing.T) {
// Create two temporary directories and initialize them as git repositories
tempDir1 := t.TempDir()
tempDir2 := t.TempDir()
client1, err := NewClient("file://"+tempDir1, NopCreds{}, true, false, "", "")
require.NoError(t, err)
client2, err := NewClient("file://"+tempDir2, NopCreds{}, true, false, "", "")
require.NoError(t, err)
err = client1.Init()
require.NoError(t, err)
err = client2.Init()
require.NoError(t, err)
// Add different files to each repository
file1 := filepath.Join(client1.Root(), "file1.txt")
err = os.WriteFile(file1, []byte("content1"), 0o644)
require.NoError(t, err)
err = runCmd(client1.Root(), "git", "add", "file1.txt")
require.NoError(t, err)
err = runCmd(client1.Root(), "git", "commit", "-m", "Add file1")
require.NoError(t, err)
file2 := filepath.Join(client2.Root(), "file2.txt")
err = os.WriteFile(file2, []byte("content2"), 0o644)
require.NoError(t, err)
err = runCmd(client2.Root(), "git", "add", "file2.txt")
require.NoError(t, err)
err = runCmd(client2.Root(), "git", "commit", "-m", "Add file2")
require.NoError(t, err)
// Assert that LsFiles returns the correct files when called sequentially
files1, err := client1.LsFiles("*", true)
require.NoError(t, err)
require.Contains(t, files1, "file1.txt")
files2, err := client2.LsFiles("*", true)
require.NoError(t, err)
require.Contains(t, files2, "file2.txt")
// Define a function to call LsFiles multiple times in parallel
var wg sync.WaitGroup
callLsFiles := func(client Client, expectedFile string) {
defer wg.Done()
for i := 0; i < 100; i++ {
files, err := client.LsFiles("*", true)
require.NoError(t, err)
require.Contains(t, files, expectedFile)
}
}
// Call LsFiles in parallel for both clients
wg.Add(2)
go callLsFiles(client1, "file1.txt")
go callLsFiles(client2, "file2.txt")
wg.Wait()
}
type mockCreds struct {
environ []string
environErr bool

View File

@@ -827,7 +827,11 @@ func (mgr *SettingsManager) GetTrackingMethod() (string, error) {
if err != nil {
return "", err
}
return argoCDCM.Data[settingsResourceTrackingMethodKey], nil
tm := argoCDCM.Data[settingsResourceTrackingMethodKey]
if tm == "" {
return string(v1alpha1.TrackingMethodAnnotation), nil
}
return tm, nil
}
func (mgr *SettingsManager) GetInstallationID() (string, error) {

View File

@@ -210,12 +210,39 @@ func TestInClusterServerAddressEnabledByDefault(t *testing.T) {
}
func TestGetAppInstanceLabelKey(t *testing.T) {
_, settingsManager := fixtures(map[string]string{
"application.instanceLabelKey": "testLabel",
t.Run("should get custom instanceLabelKey", func(t *testing.T) {
_, settingsManager := fixtures(map[string]string{
"application.instanceLabelKey": "testLabel",
})
label, err := settingsManager.GetAppInstanceLabelKey()
require.NoError(t, err)
assert.Equal(t, "testLabel", label)
})
t.Run("should get default instanceLabelKey if custom not defined", func(t *testing.T) {
_, settingsManager := fixtures(map[string]string{})
label, err := settingsManager.GetAppInstanceLabelKey()
require.NoError(t, err)
assert.Equal(t, common.LabelKeyAppInstance, label)
})
}
func TestGetTrackingMethod(t *testing.T) {
t.Run("should get custom trackingMethod", func(t *testing.T) {
_, settingsManager := fixtures(map[string]string{
"application.resourceTrackingMethod": string(v1alpha1.TrackingMethodLabel),
})
label, err := settingsManager.GetTrackingMethod()
require.NoError(t, err)
assert.Equal(t, string(v1alpha1.TrackingMethodLabel), label)
})
t.Run("should get default trackingMethod if custom not defined", func(t *testing.T) {
_, settingsManager := fixtures(map[string]string{})
label, err := settingsManager.GetTrackingMethod()
require.NoError(t, err)
assert.Equal(t, string(v1alpha1.TrackingMethodAnnotation), label)
})
label, err := settingsManager.GetAppInstanceLabelKey()
require.NoError(t, err)
assert.Equal(t, "testLabel", label)
}
func TestApplicationFineGrainedRBACInheritanceDisabledDefault(t *testing.T) {