-
Notifications
You must be signed in to change notification settings - Fork 24
[feat] Support LinodeObjectStorageBucket deletion if forceDeleteBucket is set #780
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
f236605
to
1f20f21
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #780 +/- ##
==========================================
+ Coverage 62.93% 63.50% +0.56%
==========================================
Files 69 69
Lines 6735 6958 +223
==========================================
+ Hits 4239 4419 +180
- Misses 2254 2288 +34
- Partials 242 251 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2b08f30
to
4bfc7e3
Compare
2f10fdb
to
0ac9fb6
Compare
} | ||
|
||
controllerutil.AddFinalizer(obj, finalizer) | ||
if err := s.Client.Update(ctx, obj); err != nil { |
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.
patch instead of update?
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 is following the same logic as https://github.com/linode/cluster-api-provider-linode/blob/main/cloud/scope/common.go#L188-L199 which uses Update but I'm not opposed to using Patch if that works better
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.
just worried about potential conflicts - since this is a different object
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.
conflicts are already be handled via retry/requeue on the bucket reconciler but maybe switching to patch would help with that
return err | ||
} | ||
|
||
for _, obj := range page.Contents { |
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.
should we delete page by page? might help avoid cases where the objectsToDelete
is too large for a single request
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 is borrowed from https://github.com/linode/terraform-provider-linode/blob/v3.0.0/linode/helper/objects.go#L173, I think it should be fine for us
6ff6b44
to
614c54b
Compare
32aa648
to
4181923
Compare
What this PR does / why we need it:
We want to be able to clean up buckets, which is very useful in the cases of test clusters or short-lived / non-production clusters.
This PR adds the missing bucket deletion functionality which will only perform the bucket deletion (including ALL OBJECTS IN THE BUCKET) if
LinodeObjectStorageBucket.spec.forceDeleteBucket
is set totrue
(defaults tofalse
). This is leveraged in the etcd-backup flavors via theFORCE_DELETE_OBJ_BUCKETS
env var (defaults tofalse
).Which issue(s) this PR fixes:
Fixes #415
Special notes for your reviewer:
TODOs:
Testing