Skip to content

Commit

Permalink
doc: AwsNfsVolumeBackup and AwsNfsBackupSchedule CRs (kyma-project#732)
Browse files Browse the repository at this point in the history
Co-authored-by: Iwona Langer <[email protected]>
  • Loading branch information
ravi-shankar-sap and IwonaLanger authored Oct 21, 2024
1 parent e6b8b33 commit e91661b
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/user/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ The `awsnfsvolume.cloud-resources.kyma-project.io` CRD describes the AWS EFS
instance that can be used as RWX volume in the cluster.
To learn more, read the [AwsNfsVolume Custom Resource](./resources/04-20-10-aws-nfs-volume.md) documentation.

### AwsNfsVolumeBackup CR

The `awsnfsvolumeBackup.cloud-resources.kyma-project.io` CRD describes the backup of an AWS EFS Filesystem.
To learn more, read the [AwsNfsVolumeBackup Custom Resource](./resources/04-110-10-aws-nfs-volume-backup.md) documentation.


### AwsNfsBackupSchedule CR

The `awsnfsbackupschedule.cloud-resources.kyma-project.io` CRD describes the user-defined schedule for creating a backup
of the `AwsNfsVolume` instances at regular intervals.
To learn more, read the [AwsNfsBackupSchedule Custom Resource](./resources/04-120-10-aws-nfs-backup-schedule.md) documentation.

### GcpNfsVolume CR

The `gcpnfsvolume.cloud-resources.kyma-project.io` CRD describes the GCP Filestore
Expand Down
4 changes: 4 additions & 0 deletions docs/user/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* [Resources](/cloud-manager/user/resources/README.md)
* [IpRange](/cloud-manager/user/resources/04-10-iprange.md)
* [AwsNfsVolume](/cloud-manager/user/resources/04-20-10-aws-nfs-volume.md)
* [AwsNfsVolumeBackup](/cloud-manager/user/resources/04-110-10-aws-nfs-volume-backup.md)
* [AwsNfsBackupSchedule](/cloud-manager/user/resources/04-120-10-aws-nfs-backup-schedule.md)
* [GcpNfsVolume](/cloud-manager/user/resources/04-30-10-gcp-nfs-volume.md)
* [GcpNfsVolumeBackup](/cloud-manager/user/resources/04-70-10-gcp-nfs-volume-backup.md)
* [GcpNfsBackupSchedule](/cloud-manager/user/resources/04-30-30-gcp-nfs-backup-schedule.md)
Expand All @@ -14,6 +16,8 @@
* [GcpRedisInstance](/cloud-manager/user/resources/04-60-gcp-redis-instance.md)
* [Tutorials](/cloud-manager/user/tutorials/README.md)
* [Use RWX Volumes in AWS](/cloud-manager/user/tutorials/01-10-aws-nfs-volume.md)
* [Backup RWX Volumes in AWS](/cloud-manager/user/tutorials/01-110-aws-nfs-volume-backup.md)
* [Create Scheduled Automatic RWX Volume Backups in AWS](/cloud-manager/user/tutorials/01-120-aws-scheduled-nfs-backup.md)
* [Use RWX Volumes in GCP](/cloud-manager/user/tutorials/01-20-gcp-nfs-volume.md)
* [Create VPC Peering in Azure](/cloud-manager/user/tutorials/01-30-azure-vpc-peering.md)
* [Backup RWX Volumes in GCP](/cloud-manager/user/tutorials/01-70-gcp-nfs-volume-backup.md)
Expand Down
49 changes: 49 additions & 0 deletions docs/user/resources/04-110-10-aws-nfs-volume-backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# AwsNfsVolumeBackup Custom Resource

The `awsnfsvolumebackup.cloud-resources.kyma-project.io` namespaced custom resource (CR) describes the AWS EFS Filesystem backup.
While the AWS EFS Filesystem backup is created in the underlying cloud provider subscription, it needs its source AWS
EFS Filesystem instance to be available. But upon its creation, it can be used independently of the source instance.

For a given AWS EFS Filesystem, backups are incremental. This reduces latency on backup creation.
To learn more, read [EFS Filesystem Backup Creation](https://docs.aws.amazon.com/efs/latest/ug/awsbackup.html).

## Specification <!-- {docsify-ignore} -->
This table lists the parameters of the given resource together with their descriptions:

**Spec:**

| Parameter | Type | Description |
|-----------------------------|---------------------|-------------------------------------------------------------------------------------------------------------------------------|
| **source** | object | Required. Specifies the source of the backup. |
| **source.volume** | object | Required. Reference of the existing source AwsNfsVolume that is backed up. |
| **source.volume.name** | string | Required. Name of the source AwsNfsVolume. |
| **source.volume.namespace** | string | Optional. Namespace of the source AwsNfsVolume. Defaults to the namespace of the AwsNfsVolumeBackup resource if not provided. |

**Status:**

| Parameter | Type | Description |
|-----------------------------------|------------|-------------------------------------------------------------------------------------------------------------------------------------|
| **state** | string | Signifies the current state of **CustomObject**. Its value can be either `Ready`, `Processing`, `Error`, `Warning`, or `Deleting`. |
| **conditions** | \[\]object | Represents the current state of the CR's conditions. |
| **conditions.lastTransitionTime** | string | Defines the date of the last condition status change. |
| **conditions.message** | string | Provides more details about the condition status change. |
| **conditions.reason** | string | Defines the reason for the condition status change. |
| **conditions.status** (required) | string | Represents the status of the condition. The value is either `True`, `False`, or `Unknown`. |
| **conditions.type** | string | Provides a short description of the condition. |


## Sample Custom Resource <!-- {docsify-ignore} -->

See an exemplary AwsNfsVolumeBackup custom resource:

```yaml
apiVersion: cloud-resources.kyma-project.io/v1beta1
kind: AwsNfsVolumeBackup
metadata:
name: my-backup
spec:
source:
volume:
name: my-vol
location: us-west1
```
70 changes: 70 additions & 0 deletions docs/user/resources/04-120-10-aws-nfs-backup-schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# AwsNfsBackupSchedule Custom Resource

The `awsnfsbackupschedule.cloud-resources.kyma-project.io` custom resource (CR) represents the user-defined schedule for creating a backup
of the `AwsNfsVolume` instances at regular intervals. The CR performs the following actions:
- Creates the backups by creating the `awsnfsvolumebackup.cloud-resources.kyma-project.io` resources at the specified interval.
- Enables you to specify days and times in the form of CRON expressions to automatically create the backups.
- Automatically deletes the backups when the backup reaches the configured maximum retention days value.
- Enables you to temporarily suspend or resume the backup creation/deletion.

## Specification <!-- {docsify-ignore} -->
This table lists the parameters of the given resource together with their descriptions:

**Spec:**

| Parameter | Type | Description |
|-----------------------------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **nfsVolumeRef** | object | Required. AwsNfsVolume reference. |
| **nfsVolumeRef.name** | string | Required. Name of the existing AwsNfsVolume. |
| **nfsVolumeRef.namespace** | string | Optional. The namespace of the existing AwsNfsVolume. Defaults to the namespace of the AwsNfsBackupSchedule resource if not provided. |
| **schedule** | string | Optional. CRON type expression for the schedule. When this value is empty or not specified, this schedule runs only once at the specified start time. See also [Schedule Syntax](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-syntax). |
| **prefix** | string | Optional. Prefix for the name of the created `AwsNfsVolumeBackup` resources. Defaults to name of this schedule. |
| **startTime** | metav1.Time | Optional. Start time for the schedule. Value cannot be from the past. When not specified, the schedule becomes effective immediately. |
| **endTime** | metav1.Time | Optional. End time for the schedule. Value cannot be from the past or before the `startTime`. When not specified, the schedule runs indefinitely. |
| **maxRetentionDays** | int | Optional. Maximum number of days to retain the backup resources. If not specified, the backups are retained indefinitely. If `deleteCascade` is `true` for this schedule, then all the backups are deleted when the schedule is deleted irrespective of this configuration value. |
| **suspend** | boolean | Optional. Specifies whether or not to suspend the schedule temporarily. Defaults to `false`. |
| **deleteCascade** | boolean | Optional. Specifies whether to cascade delete the backup resources when this schedule is deleted. Defaults to `false`. |

**Status:**

| Parameter | Type | Description |
|-----------------------------------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **state** (required) | string | Signifies the current state of **CustomObject**. Contains one of the following states: `Processing`, `Pending`, `Suspended`, `Active`, `Done` or `Error`. |
| **conditions** | \[\]object | Represents the current state of the CR's conditions. |
| **conditions.lastTransitionTime** | string | Defines the date of the last condition status change. |
| **conditions.message** | string | Provides more details about the condition status change. |
| **conditions.reason** | string | Defines the reason for the condition status change. |
| **conditions.status** (required) | string | Represents the status of the condition. The value is either `True`, `False`, or `Unknown`. |
| **conditions.type** | string | Provides a short description of the condition. |
| **nextRunTimes** | \[\]string | Provides the preview of the times when the next backups are created. |
| **nextDeleteTimes** | map\[string\]string | Provides the backup objects and their expected deletion time (calculated based on `maxRetentionDays`). |
| **lastCreateRun** | string | Provides the time when the last backup was created. |
| **lastCreatedBackup** | objectRef | Provides the object reference of the last created backup. |
| **lastDeleteRun** | string | Provides the time when the last backup was deleted. |
| **lastDeletedBackups** | \[\]objectRef | Provides the object references of the last deleted backups. |
| **schedule** | string | Provides the CRON expression of the current active schedule. |
| **backupIndex** | int | Provides the current index of the backup created by this schedule. |
| **backupCount** | int | Provides the the number of backups currently present in the system. |

## Sample Custom Resource <!-- {docsify-ignore} -->

See an example of the AwsNfsBackupSchedule CR:

```yaml
apiVersion: cloud-resources.kyma-project.io/v1beta1
kind: AwsNfsBackupSchedule
metadata:
name: aws-nfs-backup-schedule
namespace: kyma-dev
spec:
nfsVolumeRef:
name: aws-nfs-sample-01
namespace: kyma-dev
schedule: "0 0 * * *"
prefix: aws-nfs-daily-backup
startTime: 2024-11-01T00:00:00Z
endTime: 2025-12-31T00:00:00Z
maxRetentionDays: 365
suspend: false
deleteCascade: true
```
2 changes: 2 additions & 0 deletions docs/user/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Cloud Manager custom resources:
* [IpRange Custom Resource](./04-10-iprange.md)
* [AwsNfsVolume Custom Resource](./04-20-10-aws-nfs-volume.md)
* [AwsNfsVolumeBackup Custom Resource](./04-110-10-aws-nfs-volume-backup.md)
* [AwsNfsBackupSchedule Custom Resource](./04-120-10-aws-nfs-backup-schedule.md)
* [GcpNfsVolume Custom Resource](./04-30-10-gcp-nfs-volume.md)
* [GcpNfsVolumeBackup Custom Resource](./04-70-10-gcp-nfs-volume-backup.md)
* [GcpNfsBackupSchedule Custom Resource](./04-30-30-gcp-nfs-backup-schedule.md)
Expand Down
64 changes: 64 additions & 0 deletions docs/user/tutorials/01-110-aws-nfs-volume-backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Backup RWX Volumes in AWS

This tutorial explains how to create backups for ReadWriteMany (RWX) volumes in AWS.

## Preparation <!-- {docsify-ignore} -->

You have created an AwsNfsVolume. See [Use RWX Volumes in AWS](./01-10-aws-nfs-volume.md) to learn more.

> [!NOTE]
> All the examples below assume that the AwsNfsVolume is named `my-vol` and is in the same namespace as the AwsNfsVolumeBackup resource.
## Steps <!-- {docsify-ignore} -->

1. Export the namespace as an environment variable. Run:

```shell
export NAMESPACE={NAMESPACE_NAME}
```

2. Create an AwsNfsVolumeBackup resource.

```shell
cat <<EOF | kubectl -n $NAMESPACE apply -f -
apiVersion: cloud-resources.kyma-project.io/v1beta1
kind: AwsNfsVolumeBackup
metadata:
name: my-backup
spec:
source:
volume:
name: my-vol
EOF
```
3. Wait for the AwsNfsVolumeBackup to be in the `Ready` state.
```shell
kubectl -n $NAMESPACE wait --for=condition=Ready awsnfsvolumebackup/my-backup --timeout=300s
```
Once the AwsNfsVolumeBackup is created, you should see the following message:
```
awsnfsvolumebackup.cloud-resources.kyma-project.io/my-backup condition met
```
4. Observe the location of the created backup.
```shell
kubectl -n $NAMESPACE get awsnfsvolumebackup my-backup -o jsonpath='{.status.location}{"\n"}'
```
## Clean Up <!-- {docsify-ignore} -->
1. Export the namespace as an environment variable. Run:
```shell
export NAMESPACE={NAMESPACE_NAME}
```
2. Clean up:
* Remove the created AwsNfsVolumeBackup:
```shell
kubectl delete -n $NAMESPACE awsnfsvolumebackup my-backup
```
63 changes: 63 additions & 0 deletions docs/user/tutorials/01-120-aws-scheduled-nfs-backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Create Scheduled Automatic RWX Volume Backups in AWS

This tutorial explains how to create scheduled automatic backups for ReadWriteMany (RWX) volumes in AWS.

## Prerequisites <!-- {docsify-ignore} -->

* You have created an AwsNfsVolume. See [Use RWX Volumes in AWS](./01-10-aws-nfs-volume.md) to learn more.

> [!NOTE]
> All the examples below assume that the AwsNfsVolume is named `my-vol` and is in the same namespace as the AwsNfsBackupSchedule resource.
## Steps <!-- {docsify-ignore} -->

1. Export the namespace as an environment variable. Run:

```shell
export NAMESPACE={NAMESPACE_NAME}
```

2. Create an AwsNfsBackupSchedule resource.

```shell
cat <<EOF | kubectl -n $NAMESPACE apply -f -
apiVersion: cloud-resources.kyma-project.io/v1beta1
kind: AwsNfsBackupSchedule
metadata:
name: my-backup-schedule
spec:
nfsVolumeRef:
name: my-vol
schedule: "0 * * * *"
prefix: my-hourly-backup
deleteCascade: true
EOF
```
3. Wait for the AwsNfsVolumeBackup to be in the `Active` state.
```shell
kubectl -n $NAMESPACE wait --for=jsonpath='{.status.state}'=Active awsnfsbackupschedule/my-backup-schedule --timeout=300s
```
Once the AwsNfsVolumeBackup is created, you should see the following message:
```
awsnfsbackupschedule.cloud-resources.kyma-project.io/my-backup-schedule condition met
```
4. Observe the nextRunTimes for creating the backups.
```shell
kubectl -n $NAMESPACE get awsnfsbackupschedule my-backup-schedule -o jsonpath='{.status.nextRunTimes}{"\n"}'
```
5. Wait till the time specified in the nextRunTimes (in the previous step) passes and see that the AwsNfsVolumeBackup objects get created.
```shell
kubectl -n $NAMESPACE get awsnfsvolumebackup -l cloud-resources.kyma-project.io/scheduleName=my-backup-schedule
```
## Clean Up <!-- {docsify-ignore} -->
1. Export the namespace as an environment variable. Run:
```shell
export NAMESPACE={NAMESPACE_NAME}
```
2. Clean up:
* Remove the created schedule and the backups:
```shell
kubectl delete -n $NAMESPACE awsnfsbackupschedule my-backup-schedule
```
Loading

0 comments on commit e91661b

Please sign in to comment.