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

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 31ee850 on release-1.28 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.28.7+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-1710180471 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180471 499744 2024-03-11T18:07:51Z
on-demand-ip-172-31-7-118-1710180472 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180472 581664 2024-03-11T18:07:52Z
on-demand-ip-172-31-7-118-1710180473 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180473 655392 2024-03-11T18:07:53Z
on-demand-ip-172-31-7-118-1710180474 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180474 700448 2024-03-11T18:07:54Z
on-demand-ip-172-31-7-118-1710180475 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180475 700448 2024-03-11T18:07:55Z
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-1710180471 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180471 499744 2024-03-11T18:07:51Z
on-demand-ip-172-31-7-118-1710180472 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180472 581664 2024-03-11T18:07:52Z
on-demand-ip-172-31-7-118-1710180473 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180473 655392 2024-03-11T18:07:53Z
on-demand-ip-172-31-7-118-1710180474 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180474 700448 2024-03-11T18:07:54Z
on-demand-ip-172-31-7-118-1710180475 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710180475 700448 2024-03-11T18:07:55Z
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

$ k3s -v
k3s version v1.28.7+k3s-31ee8501 (31ee8501)
go version go1.21.7

$ 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 
etcd-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-1710181252 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181252 462880 2024-03-11T18:20:52Z
on-demand-ip-172-31-7-118-1710181253 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181253 573472 2024-03-11T18:20:53Z
on-demand-ip-172-31-7-118-1710181254 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181254 610336 2024-03-11T18:20:54Z
on-demand-ip-172-31-7-118-1710181255 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181255 725024 2024-03-11T18:20:55Z
on-demand-ip-172-31-7-118-1710181256 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181256 725024 2024-03-11T18:20:56Z
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-1710181254 
INFO[0000] Removing local snapshot /var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181253 
INFO[0000] Removing local snapshot /var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181252 
INFO[0000] Reconciling ETCDSnapshotFile resources       
INFO[0000] Deleting ETCDSnapshotFile for on-demand-ip-172-31-7-118-1710181252 
INFO[0000] Deleting ETCDSnapshotFile for on-demand-ip-172-31-7-118-1710181253 
INFO[0000] Deleting ETCDSnapshotFile for on-demand-ip-172-31-7-118-1710181254 
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-1710181255 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181255 725024 2024-03-11T18:20:55Z
on-demand-ip-172-31-7-118-1710181256 file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-7-118-1710181256 725024 2024-03-11T18:20:56Z

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