-
Notifications
You must be signed in to change notification settings - Fork 52
fix: recreate application in managed mode upon deletion from spoke #605
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
Conversation
2c71774 to
0c49341
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #605 +/- ##
==========================================
- Coverage 45.45% 45.44% -0.01%
==========================================
Files 90 90
Lines 9907 9915 +8
==========================================
+ Hits 4503 4506 +3
- Misses 4944 4949 +5
Partials 460 460 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Rizwana777 Can you please pull the latest updates from main? Hopefully, that should fix the e2e tests. |
principal/event.go
Outdated
| // In managed mode, if the application was deleted from the agent but the principal | ||
| // application is not in deletion state, we should recreate it by sending the | ||
| // application spec back to the managed agent | ||
| logCtx.Info("Recreating application in managed agent to maintain desired state") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We maintain a cache of the desired state app spec on the agent. Can we use that to revert the deletion?
Ref: #567
Also, some of these methods are being refactored to avoid duplication here #596
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rizwana777 #596 has been merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chetan-rns I will modify my PR accordingly
3cde9b8 to
2857853
Compare
2857853 to
d570ada
Compare
7a1ad7a to
e909e73
Compare
e909e73 to
59188ab
Compare
test/e2e/resync_test.go
Outdated
|
|
||
| t.Log("Verify application is deleted from managed agent") | ||
| requires.Eventually(func() bool { | ||
| app := argoapp.Application{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check may not always pass. What if the app gets recreated before we reach this check?
test/e2e/resync_test.go
Outdated
| // 1. A managed application exists on both principal and managed agent | ||
| // 2. The application is directly deleted from the managed agent (while agent is running) | ||
| // 3. The agent should detect this unauthorized deletion and recreate the application automatically | ||
| func (suite *ResyncTestSuite) Test_ManagedAppRecreationOnDirectDeletion() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this test to appcache_test.go? We have all the revert-based tests in that file. For example, here's a similar test for the autonomous agent https://github.com/argoproj-labs/argocd-agent/blob/main/test/e2e/appcache_test.go#L235
Assisted-by: Cursor Signed-off-by: Rizwana777 <[email protected]>
59188ab to
9aa7536
Compare
WalkthroughChanges add app deletion reversion logic when apps originate from the principal cluster, with conditional abort of the deletion queue path if revert succeeds. Unit and e2e tests validate the new pre-delete check and resulting app recreation behavior. Changes
Sequence DiagramsequenceDiagram
participant Queue as Deletion Queue
participant Agent as addAppDeletionToQueue
participant Manager as RevertUserInitiatedDeletion
participant Cache as App Cache
Agent->>Manager: Check if app from principal + attempt revert
alt App reverted successfully
Manager-->>Agent: reverted=true
Agent->>Cache: App remains in cache
Note over Agent: Deletion aborted
else No revert or deletion expected
Manager-->>Agent: reverted=false or error
Agent->>Queue: Enqueue deletion
Queue->>Cache: Process deletion
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (2)agent/outbound_test.go (3)
agent/outbound.go (1)
🔇 Additional comments (5)
Comment |
Assisted-by: Cursor Signed-off-by: Rizwana777 <[email protected]>
9aa7536 to
a347ec0
Compare
chetan-rns
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Rizwana777!
LGTM!
jannfis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What does this PR do / why we need it:
Application was not recreating when deleted from managed mode even though Principal is not in deletion state, In this fix application is recreating immediately once it is deleted from managed mode
Which issue(s) this PR fixes:
Fixes #?
https://issues.redhat.com/browse/GITOPS-7836
How to test changes / Special notes to the reviewer:
Checklist
Summary by CodeRabbit
Release Notes
New Features
Tests