-
Notifications
You must be signed in to change notification settings - Fork 39
fix: cascaded delete on Application should clean up all managed-agent app resources #462
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: cascaded delete on Application should clean up all managed-agent app resources #462
Conversation
263f436
to
832c241
Compare
return err | ||
} | ||
} | ||
|
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.
Not strictly related to the PR, but this makes the deletion function slightly more robust by removing finalizers if we're not able to delete within 60 seconds.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #462 +/- ##
==========================================
- Coverage 44.49% 44.47% -0.02%
==========================================
Files 86 86
Lines 10463 10495 +32
==========================================
+ Hits 4655 4668 +13
- Misses 5431 5444 +13
- Partials 377 383 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2357556
to
e22fef7
Compare
… app resources Signed-off-by: Jonathan West <jonwest@redhat.com>
Signed-off-by: Jonathan West <jonwest@redhat.com>
bab5c2e
to
e2cb339
Compare
if deletionTimestampChanged { | ||
logCtx.Infof("deletionTimestamp of managed agent changed from nil to non-nil, so deleting Application") | ||
if err := m.applicationBackend.Delete(ctx, incoming.Name, incoming.Namespace, ptr.To(backend.DeletePropagationForeground)); err != nil { | ||
return nil, err |
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.
Any reason why we should delete the resource again if the incoming resource already has a deletion timestamp set? If we remove the finalizer, it should be deleted automatically.
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 need to put the managed-agent Application
into deletion state, so that Argo CD/K8s starts the process of (cascade) deleting the child resources of the Application.
Once the child resources are deleted, the finalizer is removed.
The deletionTimestamp
field is immutable, so in order to add it to a resource you need to call the K8s Delete API
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:
.metadata.finalizer
was being removed by principalWhich issue(s) this PR fixes:
Fixes #443