Skip to content
This repository was archived by the owner on Nov 8, 2025. It is now read-only.

Conversation

@anandf
Copy link
Member

@anandf anandf commented Aug 23, 2025

Fixes argoproj/argo-cd#24242

The root cause of the issue is, when the resourceKey is calculated from the object associated withsyncTask, it is calculated from the desired object instead of the live object. In the desired object, the resourceKey will be filled in with the destination namespace configured in the Application even for cluster scoped resource, where the namespace must be empty.

Screenshot 2025-08-23 at 6 41 41 PM Screenshot 2025-08-23 at 6 42 10 PM

For fixing the issue, when the syncTask contains a liveObj, calculate the resourceKey using the live object instead of the desired object set in the syncTask. This desired object contains the application destination namespace even for cluster scoped resources.

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
@anandf anandf changed the title fix(sync): Using live obj to get the resource key if not nil fix(sync): ApplyOutOfSyncOnly=true sync option is not honoured for cluster scoped resources Aug 23, 2025
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
@codecov
Copy link

codecov bot commented Aug 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.16%. Comparing base (8849c3f) to head (6da820d).
⚠️ Report is 60 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #765      +/-   ##
==========================================
- Coverage   54.26%   47.16%   -7.11%     
==========================================
  Files          64       64              
  Lines        6164     6562     +398     
==========================================
- Hits         3345     3095     -250     
- Misses       2549     3212     +663     
+ Partials      270      255      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

anandf added 2 commits August 26, 2025 18:38
…OfSyncOnly=true

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
@anandf anandf marked this pull request as ready for review August 26, 2025 13:59
@anandf anandf requested a review from a team as a code owner August 26, 2025 13:59
anandf added 2 commits August 27, 2025 19:37
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
@anandf anandf requested a review from alexmt August 27, 2025 17:26
anandf added 2 commits August 28, 2025 23:14
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
@sonarqubecloud
Copy link

Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jannfis jannfis merged commit b3a2ec1 into argoproj:master Sep 5, 2025
4 of 5 checks passed
@anandf anandf deleted the fix_applyoutofsynconly_issue_for_cluster_resources branch September 5, 2025 14:18
anandf added a commit to anandf/gitops-engine that referenced this pull request Sep 5, 2025
…uster scoped resources (argoproj#765)

* Using live obj to get the resource key if not nil

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Fixed failing unit tests

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added test case for validating cluster scoped resources with ApplyOutOfSyncOnly=true

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Fixed gofumpt formatting errors

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Corrected unit tests for cluster scoped resources

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Removed unwanted code comments

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added comments for explaining the reason why ns is set from live object

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added comments in the unit test

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

---------

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
agaudreault pushed a commit that referenced this pull request Sep 5, 2025
…uster scoped resources (#765) (#776)

* Using live obj to get the resource key if not nil



* Fixed failing unit tests



* Added test case for validating cluster scoped resources with ApplyOutOfSyncOnly=true



* Fixed gofumpt formatting errors



* Corrected unit tests for cluster scoped resources



* Removed unwanted code comments



* Added comments for explaining the reason why ns is set from live object



* Added comments in the unit test



---------

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync option ApplyOutOfSyncOnly=true is not honoured when used with ignoreDifferences

2 participants