Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle apiGroup updates in resource-tracking #11012

Merged
merged 7 commits into from Nov 3, 2022

Conversation

leoluz
Copy link
Collaborator

@leoluz leoluz commented Oct 21, 2022

We noticed a strange behaviour in Argo CD 2.4.11 when users upgrade to a newer APIGroup (e.g. going from extensions/Ingress to networking.k8s.io/Ingress). In this case the resource sync status displays as unknown and Argo CD is unable to manage the resource anymore even if it is present in the source (git).

The issue is caused because the trackingId annotation (argocd.argoproj.io/tracking-id) changes like in the example below:
ingress-app:extensions/Ingress:default/some-ingress
ingress-app:networking.k8s.io/Ingress:default/some-ingress

This is related to the code introduced in #9791 and #10198 while addressing the issue #8683. In this case Argo CD displays the Ingress resource but stops managing it, skipping all future change in the desired state (git).

Maybe #8683 needs to be re-assessed to find a different solution not relying on the APIGroup for comparison.

Another possible fix is stop verifying the APIGroup in isSelfReferencedObj method which would make it simpler and work even when SSA is enabled. However I'd like to get @jannfis or @jessesuen opinion first before going in this direction to make sure #9791 is still covered in this case.

Signed-off-by: Leonardo Luz Almeida leonardo_almeida@intuit.com

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@codecov
Copy link

codecov bot commented Oct 25, 2022

Codecov Report

Base: 45.60% // Head: 45.61% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (f632e2f) compared to base (3d3e947).
Patch coverage: 95.83% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11012      +/-   ##
==========================================
+ Coverage   45.60%   45.61%   +0.01%     
==========================================
  Files         237      237              
  Lines       28914    28920       +6     
==========================================
+ Hits        13185    13191       +6     
  Misses      13913    13913              
  Partials     1816     1816              
Impacted Files Coverage Δ
controller/sync.go 54.05% <0.00%> (ø)
util/argo/diff/diff.go 52.41% <ø> (ø)
controller/state.go 72.93% <100.00%> (+0.34%) ⬆️
util/argo/resource_tracking.go 70.45% <100.00%> (+0.33%) ⬆️
util/settings/settings.go 51.25% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

controller/state.go Outdated Show resolved Hide resolved
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@crenshaw-dev
Copy link
Collaborator

@leoluz how far back should this be cherry-picked?

@leoluz
Copy link
Collaborator Author

leoluz commented Nov 2, 2022

@leoluz how far back should this be cherry-picked?

@crenshaw-dev I would say 2.4 branch

@crenshaw-dev crenshaw-dev added cherry-pick/2.4 Candidate for cherry picking into the 2.4 release branch cherry-pick/2.5 labels Nov 2, 2022
Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Code looks good! Feel free to take or leave the comment suggestions. 😄

controller/state.go Show resolved Hide resolved
controller/state.go Outdated Show resolved Hide resolved
controller/state.go Show resolved Hide resolved
util/argo/resource_tracking.go Outdated Show resolved Hide resolved
Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@crenshaw-dev crenshaw-dev merged commit 327936d into argoproj:master Nov 3, 2022
crenshaw-dev pushed a commit that referenced this pull request Nov 3, 2022
* fix: handle apiGroup updates in resource-tracking

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Fix test

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* change the fix approach by inspecting tracking id from the config

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* add unit-test to validate the scenario

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* fix test lint

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* review fixes

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Reword godocs for clarity

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
crenshaw-dev pushed a commit that referenced this pull request Nov 3, 2022
* fix: handle apiGroup updates in resource-tracking

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Fix test

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* change the fix approach by inspecting tracking id from the config

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* add unit-test to validate the scenario

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* fix test lint

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* review fixes

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Reword godocs for clarity

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
@crenshaw-dev
Copy link
Collaborator

Cherry-picked onto release-2.5 for 2.5.2 and release-2.4 for 2.4.17.

emirot pushed a commit to emirot/argo-cd that referenced this pull request Jan 27, 2023
* fix: handle apiGroup updates in resource-tracking

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Fix test

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* change the fix approach by inspecting tracking id from the config

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* add unit-test to validate the scenario

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* fix test lint

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* review fixes

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

* Reword godocs for clarity

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>

Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
Signed-off-by: emirot <emirot.nolan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick/2.4 Candidate for cherry picking into the 2.4 release branch cherry-pick/2.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants