Skip to content

Commit

Permalink
Update docs for cli
Browse files Browse the repository at this point in the history
Signed-off-by: Md. Ishtiaq Islam <[email protected]>
  • Loading branch information
ishtiaqhimel committed Aug 26, 2024
1 parent a39f818 commit 4836cdb
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1,075 deletions.
79 changes: 62 additions & 17 deletions docs/guides/cli/kubectl-plugin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand All @@ -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` |
Expand Down Expand Up @@ -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. |
Expand Down Expand 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:**
Expand All @@ -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:**
Expand All @@ -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. |

Expand All @@ -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. |

Expand All @@ -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 |
Expand Down Expand Up @@ -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 |
|----------------------|-------------------------------------------------------------|
Expand All @@ -549,3 +550,47 @@ kubectl stash gen rules <repository-name> [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 <repository-name> [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 <repository-name> [flags]
```

**Example**

```bash
$ kubectl stash rebuild-index my-repo --namespace=demo --read-all-packs
```
Loading

0 comments on commit 4836cdb

Please sign in to comment.