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.27] - etcd-snapshot prune does not load retention policy from config #9640

Closed
brandond opened this issue Mar 4, 2024 · 1 comment
Assignees
Milestone

Comments

@brandond
Copy link
Member

brandond commented Mar 4, 2024

Backport fix for etcd-snapshot prune does not load retention policy from config

@ShylajaDevadiga
Copy link
Contributor

Validated using commit id 1268cf0 on release-1.27 branch

Environment Details

Infrastructure
Cloud EC2 instance

Node(s) CPU architecture, OS, and Version:

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"

Cluster Configuration:
Single node

Config.yaml:

etcd-snapshot-retention: 2

Steps to reproduce the issue and validate the fix

  1. Copy config.yaml
  2. Install k3s

Results from reproducing the issue using k3s version v1.27.11+k3s1


ubuntu@ip-172-31-7-118:~$ cat config.yaml 
etcd-snapshot-retention: 2

ubuntu@ip-172-31-7-118:~$ sudo k3s etcd-snapshot list
WARN[0000] Unknown flag --etcd-snapshot-retention found in config.yaml, skipping 
Name                                 Location                                                                             Size    Created
on-demand-ip-172-31-7-118-1710181814 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181814 725024  2024-03-11T18:30:14Z
on-demand-ip-172-31-7-118-1710181816 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181816 725024  2024-03-11T18:30:16Z
on-demand-ip-172-31-7-118-1710181818 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181818 786464  2024-03-11T18:30:18Z
on-demand-ip-172-31-7-118-1710181821 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181821 1052704 2024-03-11T18:30:21Z
ubuntu@ip-172-31-7-118:~$ sudo k3s etcd-snapshot prune
WARN[0000] Unknown flag --etcd-snapshot-retention found in config.yaml, skipping 
INFO[0000] Applying snapshot retention=5 to local snapshots with prefix on-demand in /var/lib/rancher/k3s/server/db/snapshots 
INFO[0000] Reconciling ETCDSnapshotFile resources       
INFO[0000] Reconciliation of ETCDSnapshotFile resources complete 
ubuntu@ip-172-31-7-118:~$ sudo k3s etcd-snapshot list
WARN[0000] Unknown flag --etcd-snapshot-retention found in config.yaml, skipping 
Name                                 Location                                                                             Size    Created
on-demand-ip-172-31-7-118-1710181814 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181814 725024  2024-03-11T18:30:14Z
on-demand-ip-172-31-7-118-1710181816 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181816 725024  2024-03-11T18:30:16Z
on-demand-ip-172-31-7-118-1710181818 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181818 786464  2024-03-11T18:30:18Z
on-demand-ip-172-31-7-118-1710181821 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181821 1052704 2024-03-11T18:30:21Z
ubuntu@ip-172-31-7-118:~$

 

**Results from validation using k3s version **
Cannot pass two forms of the same flag

$ cat config.yaml 

etcd-snapshot-retention: 2
snapshot-retention: 2

$ sudo k3s etcd-snapshot save
Incorrect Usage: Cannot use two forms of the same flag: etcd-snapshot-retention snapshot-retention

Passing either snapshot-retention: 2 and etcd-snapshot-retention: 2 retained the expected count of snapshots

ubuntu@ip-172-31-7-118:~$ cat config.yaml 
snapshot-retention: 2

ubuntu@ip-172-31-7-118:~$ sudo k3s etcd-snapshot list
Name                                 Location                                                                             Size   Created
on-demand-ip-172-31-7-118-1710181924 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181924 516128 2024-03-11T18:32:04Z
on-demand-ip-172-31-7-118-1710181926 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181926 696352 2024-03-11T18:32:06Z
on-demand-ip-172-31-7-118-1710181929 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181929 704544 2024-03-11T18:32:09Z
on-demand-ip-172-31-7-118-1710181931 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181931 704544 2024-03-11T18:32:11Z
on-demand-ip-172-31-7-118-1710181933 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181933 704544 2024-03-11T18:32:13Z
ubuntu@ip-172-31-7-118:~$ sudo k3s etcd-snapshot prune
INFO[0000] Applying snapshot retention=2 to local snapshots with prefix on-demand in /var/lib/rancher/k3s/server/db/snapshots 
INFO[0000] Removing local snapshot /var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181929 
INFO[0000] Removing local snapshot /var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181926 
INFO[0000] Removing local snapshot /var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181924 
INFO[0000] Reconciling ETCDSnapshotFile resources       
INFO[0000] Deleting ETCDSnapshotFile for on-demand-ip-172-31-7-118-1710181924 
INFO[0000] Deleting ETCDSnapshotFile for on-demand-ip-172-31-7-118-1710181926 
INFO[0000] Deleting ETCDSnapshotFile for on-demand-ip-172-31-7-118-1710181929 
INFO[0000] Reconciliation of ETCDSnapshotFile resources complete 
ubuntu@ip-172-31-7-118:~$ sudo k3s etcd-snapshot list
Name                                 Location                                                                             Size   Created
on-demand-ip-172-31-7-118-1710181931 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181931 704544 2024-03-11T18:32:11Z
on-demand-ip-172-31-7-118-1710181933 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181933 704544 2024-03-11T18:32:13Z
ubuntu@ip-172-31-7-118:~$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done Issue
Development

No branches or pull requests

2 participants