-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat: delete in reverse order of sync waves #3959
Conversation
Signed-off-by: darshanime <[email protected]>
Signed-off-by: darshanime <[email protected]>
502c684
to
d6b2a47
Compare
Signed-off-by: darshanime <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #3959 +/- ##
==========================================
- Coverage 42.09% 42.07% -0.02%
==========================================
Files 122 123 +1
Lines 17944 17994 +50
==========================================
+ Hits 7553 7571 +18
- Misses 9425 9453 +28
- Partials 966 970 +4
Continue to review full report at Codecov.
|
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 @darshanime - LGTM so far. Only have some minor understanding question.
Just as a side-note: I know it's not widely spread in the ArgoCD codebase (yet!), but I'm a big fan of code comments explaining why something is done the way it is done - helps during reviews and also helps people understanding the code later on 🤓
controller/appcontroller.go
Outdated
if ctrl.shouldBeDeleted(app, objsMap[k]) && objsMap[k].GetDeletionTimestamp() == nil { | ||
if objsMap[k].GetDeletionTimestamp() != nil { | ||
logCtx.Infof("%d objects remaining for deletion", len(objsMap)) | ||
return objs, nil | ||
} | ||
if ctrl.shouldBeDeleted(app, objsMap[k]) { |
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.
What is the reason for the logic to return here if any of the objects has a deletion timestamp?
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.
hi @jannfis,
if we have objects pending deletion we want to wait for them to complete before we proceed with the next wave of deletion. Since this function is registered as an update handler, it will be invoked when the deletes are completed, and we can issue kubectl.DeleteResource
for the next wave then.
added a comment!
Signed-off-by: darshanime <[email protected]>
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!
Just one further question: Does that mean if any of the objects in a higher sync wave can not be deleted, the whole delete operation will be stuck and no further objects will be deleted? Can this be manually circumvented somehow? |
Yes, that's correct @jannfis, sorry forgot to point it out. I thought it's okay to have this behaviour since it's the same during sync as well - if lower sync wave fails to deploy syncing won't progress further. This can be circumvented by manually deleting the resources. |
Alright - I think we should document this behaviour in the sync wave docs. In a separate PR, before this feature is released :) |
* feat: delete in reverse order of sync waves Signed-off-by: darshanime <[email protected]> * feat: add tests for deletion in order Signed-off-by: darshanime <[email protected]> * feat: fix lint for appcontroller.go Signed-off-by: darshanime <[email protected]> * feat: add comment to explain early return Signed-off-by: darshanime <[email protected]>
I have doubt about the reverse order. We have a situation when we deployed something like
|
Signed-off-by: darshanime [email protected]
closes #3211
Checklist: