You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[8.x](backport #3143) cnvm: Delete old snapshots on startup (#3151)
cnvm: Delete old snapshots on startup (#3143)
### Summary of your changes
Change CNVM to add a background job cleaning up old snapshots.
The logic here is:
1. Background routine is started. Since the amount of leftover snapshots can be quite high (e.g. 40k in our account), 3 cleanup workers are used
2. `IterOwnedSnapshots()` is called which goes over all snapshots, returning an iterator. Snapshots are selected if:
1. They are more than 48 hours old
2. They have a tag with key "Name" and value starting with "elastic-vulnerability"
3. They are "self-owned"
3. Cleanup returns. On context cancelled, no extra grace period is added so the process doesn't block restarts/shutdown.
### Screenshot/Data
Deleted 1178 snapshots from `2025-03-25T16:17:08.384Z` to `2025-03-25T16:20:19.504Z`
### Related Issues
Closes#3105Closeshttps://github.com/elastic/sdh-security-team/issues/1168
### Checklist
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have added the necessary README/documentation (if appropriate)
#### Introducing a new rule?
No
(cherry picked from commit 8860b9d)
Co-authored-by: Orestis Floros <orestis.floros@elastic.co>
0 commit comments