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

[Release 1.24] Fixed the etcd retention to delete orphaned snapshots based on the date #8191

Merged

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

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 14, 2023 22:49
@vitorsavian vitorsavian changed the title Fixed the etcd retention to delete orphaned snapshots based on the date [Release 1.24] Fixed the etcd retention to delete orphaned snapshots based on the date Aug 14, 2023
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02% ⚠️

Comparison is base (c6f28ae) 19.54% compared to head (ce3be29) 19.52%.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.24    #8191      +/-   ##
================================================
- Coverage         19.54%   19.52%   -0.02%     
================================================
  Files                83       83              
  Lines              5583     5587       +4     
================================================
  Hits               1091     1091              
- Misses             4266     4270       +4     
  Partials            226      226              
Flag Coverage Δ
unittests 19.52% <0.00%> (-0.02%) ⬇️

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

Files Changed Coverage Δ
pkg/etcd/etcd.go 14.53% <0.00%> (-0.03%) ⬇️
pkg/etcd/s3.go 0.00% <0.00%> (ø)

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

@vitorsavian vitorsavian merged commit b0bf7e7 into k3s-io:release-1.24 Aug 15, 2023
6 checks passed
@vitorsavian vitorsavian deleted the etcd-retention-based-on-name-1.24 branch October 18, 2023 00:36
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.

2 participants