From 4836cdbe917d33fa12a2c26da7103857d58df00d Mon Sep 17 00:00:00 2001 From: "Md. Ishtiaq Islam" Date: Mon, 26 Aug 2024 13:42:23 +0600 Subject: [PATCH] Update docs for cli Signed-off-by: Md. Ishtiaq Islam --- docs/guides/cli/kubectl-plugin/index.md | 79 +- .../hooks/overview/images/job-model.svg | 1059 +---------------- docs/guides/hooks/overview/index.md | 2 + 3 files changed, 65 insertions(+), 1075 deletions(-) diff --git a/docs/guides/cli/kubectl-plugin/index.md b/docs/guides/cli/kubectl-plugin/index.md index 587b8f58..7431e7e3 100644 --- a/docs/guides/cli/kubectl-plugin/index.md +++ b/docs/guides/cli/kubectl-plugin/index.md @@ -53,7 +53,7 @@ Available command for `kubectl stash` cli are: To create a `Repository`, you need to provide a `Repository` name and backend information and credential. You will provide the information and credential by using flags. The available flags are: | Flag | Description | -| ------------------- | ----------------------------------------------------------------------------- | +|---------------------|-------------------------------------------------------------------------------| | `--namespace` | Indicates the namespace where the Repository will be created | | `--secret` | Specify the name of the storage secret that will be used to create Repository | | `--bucket` | Specify the name of the cloud bucket/container. | @@ -79,13 +79,13 @@ $ kubectl stash create repository gcs-repo --namespace=demo --secret=gcs-secret To create a `BackupConfiguration`, you need to provide `BackupConfiguration` name, `Repository` name, Target, and RetentionPolicy, etc. You will provide the `Repository` name, Target, RetentionPolicy by using flags. The available flags are: | Flag | Description | -| ----------------------- | ---------------------------------------------------------------------------------------------- | +|-------------------------|------------------------------------------------------------------------------------------------| | `--namespace` | Indicates the namespace where the `BackupConfiguration` will be created | | `--target-apiversion` | Specify API-Version of the target resource. | | `--target-kind` | Specify kind of the target resource. | | `--target-name` | Specify name of the target resource. | -| `--repo-name` | Specify name of the `Repository` that will be created. | -| `--repo-namespace` | Specify namespace of the `Repository` that will be created. | +| `--repo-name` | Specify name of the `Repository` that will be created. | +| `--repo-namespace` | Specify namespace of the `Repository` that will be created. | | `--schedule` | Specify schedule of the backup. | | `--driver` | `Driver` indicates the mechanism used to backup (i.e. VolumeSnapshotter, Restic) | | `--task` | Specify name of a `Task` | @@ -121,13 +121,13 @@ $ kubectl stash create backupconfig ss-backup --namespace=demo --repo-name=gcs-r To create a `RestoreSession`, you need to provide a `Repository` name, Target or `VolumeClaimTemplate`, etc. You will provide the `Repository` name, Target or `VolumeClaimTemplate` by using flags. The available flags are: | Flag | Description | -| ---------------------- | ------------------------------------------------------------------------------ | +|------------------------|--------------------------------------------------------------------------------| | `--namespace` | Indicates the namespace where the `RestoreSession` will be created | | `--target-apiversion` | API-Version of the target resource. | | `--target-kind` | Specify kind of the target resource. | | `--target-name` | Specify name of the target resource. | -| `--repo-name` | specify name of the `Repository`. | -| `--repo-namespace` | specify namespace of the `Repository` | +| `--repo-name` | specify name of the `Repository`. | +| `--repo-namespace` | specify namespace of the `Repository` | | `--driver` | Driver indicates the mechanism used to backup (i.e. VolumeSnapshotter, Restic) | | `--task` | Name of the Task | | `--replica` | Replica specifies the number of replicas whose data should be backed up. | @@ -163,9 +163,9 @@ $ kubectl stash create restoresession ss-restore --namespace=demo --repo-name=gc To copy a Secret, you need to provide Secret name and destination namespace. You will provide the destination namespace by using flag. The available flags are: -| Flag | Description | -| ---------------- |----------------------------------------------------------------------| -| `--namespace` | Indicates the namespace of the respective `Secret`. | +| Flag | Description | +|------------------|------------------------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Secret`. | | `--to-namespace` | Indicates the destination namespace where the `Secret` will be copied. | **Format:** @@ -189,9 +189,9 @@ To copy a Repository, you need to provide a Repository name and destination name You will provide the destination namespace by using flag. The available flags are: -| Flag | Description | -| ---------------- |-----------------------------------------------------------------------| -| `--namespace` | Indicates the namespace of the respective `Repository`. | +| Flag | Description | +|------------------|----------------------------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository`. | | `--to-namespace` | Indicates the destination namespace where the `Repository` will be copied. | **Format:** @@ -217,7 +217,7 @@ To copy a BackupConfiguration, you need to provide BackupConfiguration name and You will provide the destination namespace by using flags. The available flags are: | Flag | Description | -| ---------------- |-------------------------------------------------------------------------------------| +|------------------|-------------------------------------------------------------------------------------| | `--namespace` | Indicates the namespace of the respective `BackupConfiguration`. | | `--to-namespace` | Indicates the destination namespace where the `BackupConfiguration` will be copied. | @@ -238,7 +238,7 @@ $ kubectl stash cp backupconfig my-backupconfig --namespace=demo --to-namespace= To copy a VolumeSnapshot, you need to provide `VolumeSnapshot` name and destination namespace. You will provide the destination namespace by using flag. The available flags are: | Flag | Description | -| ---------------- |--------------------------------------------------------------------------------| +|------------------|--------------------------------------------------------------------------------| | `--namespace` | Indicates the namespace of the respective `VolumeSnapshot`. | | `--to-namespace` | Indicates the destination namespace where the `VolumeSnapshot` will be copied. | @@ -261,7 +261,7 @@ To clone a PVC, you need to provide backend credentials for creating Repository. You will provide the backend credential by using flags. The available flags are: | Flag | Description | -| ------------------- |-------------------------------------------------------------------------------| +|---------------------|-------------------------------------------------------------------------------| | `--namespace` | Indicates namespace of the respective pvc. | | `--to-namespace` | Indicates the destination namespace where the PVC will be cloned. | | `--secret` | Specify the name of the storage secret that will be used to create Repository | @@ -530,7 +530,8 @@ $ 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. The available flags for this command are: +`kubectl stash gen rules` 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. The available flags for this command are: | Flag | Description | |----------------------|-------------------------------------------------------------| @@ -549,3 +550,47 @@ kubectl stash gen rules [flags] ```bash $ kubectl stash gen rules my-repo --namespace=demo --timestamp 2023-10-05T05:16:11Z ``` + +## Check Repository + +`kubectl stash check` command is used to test the restic repository for errors and reports any errors it finds. It can also be used to read all data and therefore simulate a restore. By default, the command will always load all data directly from the repository and not use a local cache. The available flags for this command are: + +| Flag | Description | +|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository`. | +| `--read-data` | Read all data blobs. | +| `--with-cache` | Use existing cache, only read uncached data from repository. | +| `--read-data-subset` | Read a subset of data packs, specified as 'n/t' for specific part, or either 'x%' or 'x.y%' or a size in bytes with suffixes k/K, m/M, g/G, t/T for a random subset | + +**Format** + +```bash +kubectl stash check [flags] +``` + +**Example** + +```bash +$ kubectl stash check my-repo --namespace=demo --read-data +``` + +## Rebuild Index + +`kubectl stash rebuild-index` command is used to create a new index based on the pack files in the repository. + +| Flag | Description | +|--------------------|---------------------------------------------------------| +| `--namespace` | Indicates the namespace of the respective `Repository`. | +| `--read-all-packs` | Read all pack files to generate new index from scratch. | + +**Format** + +```bash +kubectl stash rebuild-index [flags] +``` + +**Example** + +```bash +$ kubectl stash rebuild-index my-repo --namespace=demo --read-all-packs +``` \ No newline at end of file diff --git a/docs/guides/hooks/overview/images/job-model.svg b/docs/guides/hooks/overview/images/job-model.svg index f31032cd..4364932b 100644 --- a/docs/guides/hooks/overview/images/job-model.svg +++ b/docs/guides/hooks/overview/images/job-model.svg @@ -1,1058 +1 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/docs/guides/hooks/overview/index.md b/docs/guides/hooks/overview/index.md index 425de7f4..4b3635ac 100644 --- a/docs/guides/hooks/overview/index.md +++ b/docs/guides/hooks/overview/index.md @@ -91,6 +91,8 @@ If the backup or restore process fails then the respective `postBackup` or `post - `OnFailure`: The hook will be executed after the backup/restore process only if the backup/restore has failed. - `OnFinalRetryFailure`: The hook will be executed after the backup process only if the backup has failed with no more retry attempts left. +In case of backup job, if the postBackup hook container doesn't run for any reason, the postBackup hook is executed by the Stash operator instead of the backup job (if targeted application is not `AppBinding`). For `AppBinding`, hook is executed in the targeted application pod. + If the `postBackup` or `postRestore` hook fails, the respective BackupSession or RestoreSession will be marked as `Failed`. ## Templating Support in Hook