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.25] Fixed the etcd retention to delete orphaned snapshots based on the date #8190

Merged

Conversation

vitorsavian
Copy link
Contributor

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

codecov bot commented Aug 14, 2023

Codecov Report

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

Comparison is base (5a25061) 19.40% compared to head (d36c2c0) 19.38%.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.25    #8190      +/-   ##
================================================
- Coverage         19.40%   19.38%   -0.02%     
================================================
  Files                83       83              
  Lines              5634     5638       +4     
================================================
  Hits               1093     1093              
- Misses             4315     4319       +4     
  Partials            226      226              
Flag Coverage Δ
unittests 19.38% <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 ce85b98 into k3s-io:release-1.25 Aug 15, 2023
11 checks passed
@vitorsavian vitorsavian deleted the etcd-retention-based-on-name-1.25 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.

None yet

2 participants