-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add ability to perform an etcd on-demand snapshot via cli #2819
Conversation
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Co-authored-by: Brad Davidson <brad@oatmail.org>
Co-authored-by: Brad Davidson <brad@oatmail.org>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits to the name/etc-snapshot-name UX.
Note that you don't have to explicitly put the default in the usage text if you specify a value; the CLI library does this for you:
[root@centos01 ~]# k3s etcd-snapshot --help | grep name
--name value (db) Set the name of the etcd on-demand snapshot. Default: on-demand-<unix-timestamp> (default: "on-demand-1611166541")
[root@centos01 ~]# k3s etcd-snapshot --help | grep name
--name value (db) Set the name of the etcd on-demand snapshot. Default: on-demand-<unix-timestamp> (default: "on-demand-1611166542")
[root@centos01 ~]# k3s etcd-snapshot --help | grep name
--name value (db) Set the name of the etcd on-demand snapshot. Default: on-demand-<unix-timestamp> (default: "on-demand-1611166543")
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs <brian.downs@gmail.com>
Co-authored-by: Brad Davidson <brad@oatmail.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for one docstring typo I just noticed
Co-authored-by: Brad Davidson <brad@oatmail.org>
The PR looks good to me, the only comment I have is that I can see users confuse the command with non-embedded etcd k3s, meaning that when user trigger this command with kine it may return etcd error saying that it cant connect to etcd or sometthing similar, it may benefit us to display an error stating that etcd embedded isnt set up. |
If this is ran on a system not running etcd, this is the output: FATA[2021-01-20T20:25:37.727386821Z] managed etcd database has not been initialized |
thats good enough for me, LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* add ability to perform an etcd on-demand snapshot via cli Signed-off-by: Brian Downs <brian.downs@gmail.com> (cherry picked from commit 1322901)
* add ability to perform an etcd on-demand snapshot via cli (cherry picked from commit 1322901) Signed-off-by: Brian Downs <brian.downs@gmail.com>
Signed-off-by: Brian Downs brian.downs@gmail.com
Proposed Changes
This PR adds a new sub-command to the K3s command called
etcd-snapshot
and it takes a number of the standard K3s flags as well as specific flags likename
, used to give the snapshot a specific name anddir
used to tell K3s where to save the snapshot. The former use applicable in this use case as well as for cron scheduled snapshots and keeps in like with RKE features for snapshotting and will ultimately be pulled into RKE2. An on-demand snapshot will not effect snaptshot retention.Types of Changes
Verification
k3s etcd-snapshot
to perform an etcd snapshot.A. Verify the snapshot has been performed successfully via log output
{"level":"info","msg":"saved","path":"/var/lib/rancher/k3s/server/db/snapshots/on-demand-<unix-timestamp>"}
B. Verify that the newly created snapshot is indeed at the expected location
k3s etcd-snapshot --name=my_snapshot
to perform and etcd snapshot now.A. Perform the same verification steps from above.
Linked Issues
#2758
Further Comments