Skip to content
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

Fixed the etcd retention to delete orphaned snapshots based on the date #8177

Merged
merged 12 commits into from
Aug 14, 2023

Conversation

vitorsavian
Copy link
Member

Proposed Changes

  • Delete the oldest snapshot files inside the node and s3 if the snapshot count is greater than the retention, regardless of the node name.

  • The delete will occur based on the the date in the name of the file.

Types of Changes

  • Fix

Verification

Need to create a cluster with etcd snapshots enabled and s3

k3s server --cluster-init --etcd-snapshot-schedule-cron "*/1 * * * *" --etcd-snapshot-retention 2 --etcd-s3 --etcd-s3-access-key --etcd-s3-secret-key --etcd-s3-bucket

Then you can see in the /var/lib/rancher/k3s/server/db/snapshots that will maintain the retention

ls /var/lib/rancher/server/db/snapshots

If you are using AWS, you can just reboot the machine to have another name, and just restarted the cluster, it will still delete the snapshot inside /var/lib/rancher/server/db/snapshots and maintain the retention

Testing

Linked Issues

User-Facing Change

NONE

Further Comments

  • This fix was found in the Issue Validations from QA

@vitorsavian vitorsavian requested a review from a team as a code owner August 12, 2023 02:03
Signed-off-by: Vitor <[email protected]>
@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: +6.68% 🎉

Comparison is base (561db17) 44.10% compared to head (44d6723) 50.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8177      +/-   ##
==========================================
+ Coverage   44.10%   50.78%   +6.68%     
==========================================
  Files         144      144              
  Lines       14614    14620       +6     
==========================================
+ Hits         6445     7425     +980     
+ Misses       7111     6016    -1095     
- Partials     1058     1179     +121     
Flag Coverage Δ
e2etests 49.42% <0.00%> (?)
inttests 41.84% <50.00%> (+0.53%) ⬆️
unittests 19.92% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
pkg/etcd/s3.go 0.00% <0.00%> (ø)
pkg/etcd/etcd.go 42.15% <100.00%> (+6.39%) ⬆️

... and 49 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/etcd/etcd.go Outdated Show resolved Hide resolved
pkg/etcd/etcd.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants