Skip to content

Commit

Permalink
Handle conflicts b/w data protection at cluster and cluster-group level
Browse files Browse the repository at this point in the history
Signed-off-by: Astha Agarwal  <asagarwal@vmware.com>
  • Loading branch information
asagarwal committed Jan 16, 2024
1 parent d2a42b7 commit eaeb054
Show file tree
Hide file tree
Showing 11 changed files with 294 additions and 453 deletions.
74 changes: 55 additions & 19 deletions docs/data-sources/backup_schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ Description: |-
# Backup Schedule Data Source

This data source enables users to list existing backup schedules by cluster or cluster group scope.
Listing backup schedules by cluster or cluster group scope is supported only for clusters/cluster-groups enabled with data protection.

## Cluster Backup Schedule
### Example Usage
## Example Usage

```terraform
data "tanzu-mission-control_backup_schedule" "demo" {
name = "BACKUP_SCHEDULE_NAME"
name = "BACKUP_SCHEDULE_NAME"
scope {
cluster {
management_cluster_name = "MGMT_CLS_NAME"
Expand All @@ -30,14 +29,14 @@ data "tanzu-mission-control_backup_schedule" "demo" {
```

## Cluster Group Backup Schedule
### Example Usage
## Example Usage

```terraform
data "tanzu-mission-control_backup_schedule" "demo" {
name = "BACKUP_SCHEDULE_NAME"
name = "BACKUP_SCHEDULE_NAME"
scope {
cluster_group {
cluster_group_name = "CG_NAME"
cluster_group_name = "CG_NAME"
}
}
Expand All @@ -52,13 +51,13 @@ data "tanzu-mission-control_backup_schedule" "demo" {

### Required

- `name` (String) The name of the backup schedule
- `scope` (Block List, Min: 1, Max: 1) Search scope block (see [below for nested schema](#nestedblock--scope))

### Optional

- `include_total_count` (Boolean) Whether to include total count of backups.
(Default: True)
- `name` (String) The name of the backup schedule
- `query` (String) Define a query for listing backups
- `sort_by` (String) Sort backups by field.

Expand All @@ -74,23 +73,28 @@ data "tanzu-mission-control_backup_schedule" "demo" {
Optional:

- `cluster` (Block List, Max: 1) Cluster scope block (see [below for nested schema](#nestedblock--scope--cluster))
- `cluster_group` (Block List, Max: 1) The schema for cluster group full name (see [below for nested schema](#nestedblock--scope--cluster_group))
- `cluster_group` (Block List, Max: 1) Cluster group scope block (see [below for nested schema](#nestedblock--scope--cluster_group))

<a id="nestedblock--scope--cluster"></a>
### Nested Schema for `scope.cluster`

Required:

- `cluster_name` (String) Cluster name

Optional:

- `management_cluster_name` (String) Management cluster name
- `provisioner_name` (String) Cluster provisioner name


<a id="nestedblock--scope--cluster_group"></a>
### Nested Schema for `scope.cluster_group`

Required:

- `cluster_group_name` (String) Name of the cluster group
- `cluster_group_name` (String) Cluster group name



<a id="nestedatt--schedules"></a>
Expand All @@ -102,6 +106,7 @@ Read-Only:
- `meta` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--meta))
- `name` (String)
- `scope` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--scope))
- `selector` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--selector))
- `spec` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--spec))

<a id="nestedobjatt--schedules--meta"></a>
Expand All @@ -122,7 +127,7 @@ Read-Only:
Read-Only:

- `cluster` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--scope--cluster))
- `cluster_group` (Block List, Max: 1) The schema for cluster group full name (see [below for nested schema](#nestedblock--scope--cluster_group))
- `cluster_group` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--scope--cluster_group))

<a id="nestedobjatt--schedules--scope--cluster"></a>
### Nested Schema for `schedules.scope.cluster`
Expand All @@ -133,12 +138,43 @@ Read-Only:
- `management_cluster_name` (String)
- `provisioner_name` (String)

<a id="nestedblock--scope--cluster_group"></a>
### Nested Schema for `scope.cluster_group`

Required:
<a id="nestedobjatt--schedules--scope--cluster_group"></a>
### Nested Schema for `schedules.scope.cluster_group`

Read-Only:

- `cluster_group_name` (String)



<a id="nestedobjatt--schedules--selector"></a>
### Nested Schema for `schedules.selector`

Read-Only:

- `excluded_names` (List of String)
- `label_selector` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--selector--label_selector))
- `names` (List of String)

<a id="nestedobjatt--schedules--selector--label_selector"></a>
### Nested Schema for `schedules.selector.label_selector`

Read-Only:

- `match_expression` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--selector--label_selector--match_expression))
- `match_labels` (Map of String)

<a id="nestedobjatt--schedules--selector--label_selector--match_expression"></a>
### Nested Schema for `schedules.selector.label_selector.match_labels`

Read-Only:

- `key` (String)
- `operator` (String)
- `values` (List of String)


- `cluster_group_name` (String) Name of the cluster group


<a id="nestedobjatt--schedules--spec"></a>
Expand Down Expand Up @@ -167,24 +203,24 @@ Read-Only:
- `csi_snapshot_timeout` (String)
- `default_volumes_to_fs_backup` (Boolean)
- `default_volumes_to_restic` (Boolean)
- `excluded_cluster_scoped_resources` (List of String)
- `excluded_namespace_scoped_resources` (List of String)
- `excluded_namespaces` (List of String)
- `excluded_resources` (List of String)
- `hooks` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--spec--template--hooks))
- `include_cluster_resources` (Boolean)
- `included_cluster_scoped_resources` (List of String)
- `included_namespace_scoped_resources` (List of String)
- `included_namespaces` (List of String)
- `included_resources` (List of String)
- `label_selector` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--spec--template--label_selector))
- `or_label_selector` (List of Object) (see [below for nested schema](#nestedobjatt--schedules--spec--template--or_label_selector))
- `ordered_resources` (Map of String)
- `snapshot_move_data` (Boolean)
- `snapshot_volumes` (Boolean)
- `storage_location` (String)
- `sys_excluded_namespaces` (List of String)
- `volume_snapshot_locations` (List of String)
- `included_cluster_scoped_resources` (List of String)
- `excluded_cluster_scoped_resources` (List of String)
- `included_namespace_scoped_resources` (List of String)
- `excluded_namespace_scoped_resources` (List of String)
- `snapshot_move_data` (Boolean)

<a id="nestedobjatt--schedules--spec--template--hooks"></a>
### Nested Schema for `schedules.spec.template.volume_snapshot_locations`
Expand Down
10 changes: 8 additions & 2 deletions docs/guides/tanzu-mission-control_data_protection.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
---
Title: "Data Protection of a Tanzu Kubernetes Cluster"
Description: |-
An example of using Data Protection Feature for a Tanzu Kubernetes Cluster
An example of using Data Protection Feature for a Tanzu Kubernetes Cluster/Cluster Group
---
# Enable Data Protection

The `tanzu-mission-control_enable_data_protection` resource enables users to activate and set up data protection for a Tanzu Kubernetes Cluster.
Once enabled, users can create instant backups or schedule backups for later.

**NOTE :** To resolve cluster and cluster group data protection conflicts use the below command
``terraform refresh``

For more information regarding data protection, see [Data Protection][data-protection].

[data-protection]: https://docs.vmware.com/en/VMware-Tanzu-Mission-Control/services/tanzumc-concepts/GUID-C16557BC-EB1B-4414-8E63-28AD92E0CAE5.html
Expand All @@ -26,7 +29,10 @@ For more information regarding target location, see [Target Location][target-loc

# Backup Schedule

The `tanzu-mission-control_backup_schedule` resource enables users to create and configure scheduled backups in a cluster.
The `tanzu-mission-control_backup_schedule` resource enables users to create and configure scheduled backups in a cluster/cluster-group.

NOTE : To resolve cluster and cluster group backup schedule conflicts use the below command
``terraform refresh``

Backups can be applied in 3 levels:

Expand Down
Loading

0 comments on commit eaeb054

Please sign in to comment.