-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: add Prune and Delete as application level sync option #23370
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
base: master
Are you sure you want to change the base?
Conversation
❌ Preview Environment undeployed from BunnyshellAvailable commands (reply to this comment):
|
f5381c1 to
b2ca286
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #23370 +/- ##
=======================================
Coverage 60.78% 60.79%
=======================================
Files 351 351
Lines 60439 60468 +29
=======================================
+ Hits 36737 36760 +23
- Misses 20782 20786 +4
- Partials 2920 2922 +2 ☔ View full report in Codecov by Sentry. |
b2ca286 to
5d5a4c3
Compare
pjiang-dev
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.
Could you create an issue describing what the issue/enhancement is and why this change is needed and link it to this PR and your gitops-engine PR?
Sure! I just did that here: #23380 |
|
The deletion part LGTM. Maybe helpful to add a screenshot or video of the sync option working. Thanks |
docs/user-guide/sync-options.md
Outdated
| argocd.argoproj.io/sync-options: Prune=false | ||
| ``` | ||
| It also can be enabled at the application level like in the example below: |
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.
Also just one question, if an application's resource has prune=true enabled, but the application has prune=false, which one takes priority? I am assuming resource level should take priority ? Same with the other options.
If not documented somewhere already i think its worth mentioning in the docs
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.
The Prune/Delete=true are not an actual thing, it's just something added in the UI that can act as a default option. Prune=helloworld would be similarly handled technically :p.
For the rest of the options there is not really a priority thing currently, both behavior will apply. For instance if you have Delete=confirm and Delete=false on some resources it will ask you for confirmation and do not delete the resource marked as delete=false (and similarly with prune). I will add clarification for that in docs, thanks!
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.
Done! Let me know if the new doc is more clear!
5d5a4c3 to
5ab9a2b
Compare
Sure, will try to provide a video later today! |
|
(rebasing for the go.mod conflict below and bumping the gitops-engine fork, no other code change) |
98975a0 to
12498ec
Compare
|
@pjiang-dev here is the video (I had to fix a dumb typo https://github.com/argoproj/gitops-engine/compare/13f9343d366f59f29905dda9c8ef4e6257a67c67..03789b820ebec73de41af43a35493983c1832e01 in the gitops-engine so thanks for making me double check 🙈) recording.mp4 |
|
FYI here is the yaml that I am using in the video above: |
docs/user-guide/sync-options.md
Outdated
| It also can be enabled at the application level like in the example below: | ||
|
|
||
| ```yaml | ||
| apiVersion: argoproj.io/v1alpha1 | ||
| kind: Application | ||
| spec: | ||
| syncPolicy: | ||
| syncOptions: | ||
| - Prune=confirm | ||
| ``` | ||
|
|
||
| Note that setting a Prune sync option on the application level will not override | ||
| the same sync option set on a specific resource, both will still be applied. | ||
|
|
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.
Instead of repeating the doc, specify that the same value can be use either through the annotation or the sync option.
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 don't mind doing that but IIUC adding both like that is consistent with the current doc, for instance ServerSideApply: https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#server-side-apply
ui/src/app/applications/components/application-sync-options/application-sync-options.tsx
Outdated
Show resolved
Hide resolved
12498ec to
38e4817
Compare
|
Hi @agaudreault, kind reminder about this PR, would love to have your updated input on the matter whenever you have time do so 🙏 |
|
Would also be ace to see this merged - just upgraded Argo on all our clusters only to find out that the option isn't there yet, just the annotation on resources 😁 |
|
+1 I really need it |
fc8fca0 to
a42b925
Compare
agaudreault
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.
Waiting for changes over the resource annotation precedence. Other than that, feature looks good 👍
36ccce0 to
3d4d8d1
Compare
This will facilitate adding logic on sync options that can be defined both at the app and resource level and the resource level should override the app level option. Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
Add support for Delete sync options on the application level. The Delete sync option at the application level is only changing the "default behavior" for resources deployed by this application. The behavior is still to process this at the resource level and the resource level always override the app level Delete option. Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
Add support for Prune sync options on the application level. The Prune sync option at the application level is only changing the "default behavior" for resources deployed by this application. The behavior is still to process this at the resource level and the resource level always override the app level Prune option. Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
Prune=confirm was correctly wired everywhere but the UI was still relying on Delete=confirm to show the "Confirm Pruning" button. Meaning that if an app was containing Prune=confirm resource and no resources Delete=confirm the button would never show up in the UI! Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
3d4d8d1 to
298e05f
Compare
Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
298e05f to
4720a94
Compare
|
@agaudreault I added the change for the resource precedence as you suggested. I also included the fix I did here #23326 in a separate commit as this PR changed a bit the code related to that and the other PR won't really be applicable anymore. We could still keep the other fix PR as a cherry pick to the release branches if necessary. Although AFAIU no one complained about this bug and it's something that I discovered while developing this so it might be just fine to not cherry pick it 🤷♂️. Let me know WDYT of this new version 🙏 |
Checklist:
My goal was mainly to add Prune/Delete=confirm as a sync option as the deletion confirmation acts on the whole Application already and it's way more convenient in our env to add it on the application level than as annotation on the resources actually deployed.
For consistency I also added Prune/Delete=false support there (separate commit).
And the UI option in when editing the sync policy for the Prune and Delete sync options
Closes #23380