Repo Added
|
Files
317
|
Badge
README BADGES
|
github
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 https://github.com/elastic/cloudbeat/issues/3105 Closes https://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 8860b9d9c)
96 of 101 new or added lines in 4 files covered. (95.05%)
9099 of 11969 relevant lines covered (76.02%)
16.18 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|