From d5e6c95821b1f2c55de0ee7861e686a124e3881c Mon Sep 17 00:00:00 2001 From: hmsayem Date: Mon, 9 Oct 2023 18:47:18 +0600 Subject: [PATCH] Add new cli commands Signed-off-by: hmsayem --- docs/guides/cli/kubectl-plugin/index.md | 135 ++++++++++++++++++++++-- 1 file changed, 127 insertions(+), 8 deletions(-) diff --git a/docs/guides/cli/kubectl-plugin/index.md b/docs/guides/cli/kubectl-plugin/index.md index fe23590a..7af80e8e 100644 --- a/docs/guides/cli/kubectl-plugin/index.md +++ b/docs/guides/cli/kubectl-plugin/index.md @@ -38,6 +38,11 @@ Available command for `kubectl stash` cli are: | [debug backup](#debug-backup) | Debug Stash backup issues. | | [debug restore](#debug-restore) | Debug Stash restore issues. | | [debug operator](#debug-operator) | Debug Stash operator issues. | +| [key list](#key-list) | List the keys (passwords) of a restic repository. | +| [key add](#key-add) | Add a new key (password) to a restic repository. | +| [key update](#key-update) | Update current key (password) of a restic repository. | +| [key remove](#key-remove) | Remove a key (password) of a restic repository. | +| [gen rules](#generate-rules) | Generate restore rules from nearest snapshots at a specific time | ## Create Command @@ -337,12 +342,8 @@ kubectl stash unlock [flags] $ kubectl stash unlock my-repo --namespace=demo ``` -## Pause Command - -`kubectl stash pause` command is used to pause Stash backup temporarily. - -### Pause Backup -To pause a backup you have to provide the `BackupConfiguration` name or `BackupBatch` name by using flags. The available flags are: +## Pause Backup +`kubectl stash pause` command is used to pause Stash backup temporarily. To pause a backup you have to provide the `BackupConfiguration` name or `BackupBatch` name by using flags. The available flags are: | Flag | Description | |------------------|-----------------------------------------------------------------------------------| @@ -362,8 +363,9 @@ kubectl stash pause backup [flags] $ kubectl stash pause backup --namespace=demo --backupconfig=my-config ``` -### Resume Backup -To resume a backup you have to provide the `BackupConfiguration` name or `BackupBatch` name by using flags. The available flags are: +## Resume Backup + +`kubectl stash pause` comand is used to resume a backup. The available flags are: | Flag | Description | |------------------|-----------------------------------------------------------------------------------| @@ -430,3 +432,120 @@ kubectl stash debug restore [flags] ```bash $ kubectl stash debug restore --namespace=demo --restoresession=my-restore ``` + +### Debug Operator + +To show version related information and operator logs + +**Example:** + +```bash +$ kubectl stash debug operator +``` + +### Key Command + +`kubectl stash key` command is used to manage keys (passwords) for a restic repository. + +### Key List + +To list restic keys (passwords) of a restic repository. + +**Format:** + +```bash +kubectl stash key list [flags] +``` + +**Example:** + +```bash +$ kubectl stash key list my-repo --namespace=demo +``` + +### Key Add + +To add a new key (password) to a restic repository. You will provide the information of the new key by using flags. The available flags are: + +| Flag | Description | +|-----------------------|--------------------------------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository` | +| `--host` | Host of the new key. | +| `--user` | User of the new key. | +| `--new-password-file` | File from which to read the new password file. | + +**Format:** + +```bash +kubectl stash key add [flags] +``` + +**Example:** + +```bash +$ kubectl stash key list my-repo --namespace=demo --user root --host my-host --new-password-file password.txt +``` + +### Key Update + +To update the current key (password) of a restic repository. You will provide the updated key by using flag. The available flags are: + +| Flag | Description | +|-----------------------|--------------------------------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository` | +| `--new-password-file` | File from which to read the new password file. | + +**Format:** + +```bash +kubectl stash key update [flags] +``` + +**Example:** + +```bash +$ kubectl stash key list my-repo --namespace=demo --new-password-file password.txt +``` + +### Key Remove + +To remove a key (password) of a restic repository. You will provide the ID of the key to remove by using flag. The available flags are: + +| Flag | Description | +|---------------|--------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository` | +| `--id` | ID of the restic key. | + +**Format:** + +```bash +kubectl stash key remove [flags] +``` + +**Example:** + +```bash +$ kubectl stash key remove my-repo --namespace=demo --id cdc89a7d +``` + +## Generate Rules + +`kubectl stash debug` command is used to create rules for a RestoreSession to recover the database and application backups. This command finds the nearest repository snapshots for a given timestamp and generates two rules: one for the snapshots just before the specified timestamp and another for those at or after the specified timestamp. You will provide the timestamp by using flag. The available flags are: + +| Flag | Description | +|----------------------|-------------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository` | +| `--timestamp` | Timestamp to find the closest snapshots. | +| `--group-interval` | Specifies the time gap between batches of backup snapshots. | +| `--request-timeout` | Request timeout duration for the kubectl command. | + +**Format:** + +```bash +kubectl stash gen rules [flags] +``` +**Example:** + +```bash +$ kubectl stash gen rules my-repo --namespace=demo --timestamp 2023-10-05T05:16:11Z +```