From 041835d1afc39ed93c25a8d25a1508e7e3b86b19 Mon Sep 17 00:00:00 2001 From: Xieql Date: Fri, 25 Aug 2023 17:11:10 +0800 Subject: [PATCH] backup: update with review Signed-off-by: Xieql --- .../en/references/backups_v1alpha1_types.html | 739 +++++++-------- .../crds/backup.kurator.dev_backups.yaml | 839 +++++++++--------- .../crds/backup.kurator.dev_migrates.yaml | 691 +++++++++------ .../crds/backup.kurator.dev_restores.yaml | 717 ++++++++------- pkg/apis/backups/v1alpha1/backup_type.go | 112 +-- .../v1alpha1/{util.go => common_type.go} | 49 +- pkg/apis/backups/v1alpha1/migrate_type.go | 39 +- pkg/apis/backups/v1alpha1/restore_type.go | 88 +- .../backups/v1alpha1/zz_generated.deepcopy.go | 358 +++++--- .../backups/v1alpha1/zz_generated.register.go | 3 + 10 files changed, 1969 insertions(+), 1666 deletions(-) rename pkg/apis/backups/v1alpha1/{util.go => common_type.go} (63%) diff --git a/docs/content/en/references/backups_v1alpha1_types.html b/docs/content/en/references/backups_v1alpha1_types.html index 637118bb9..80c6a99b0 100644 --- a/docs/content/en/references/backups_v1alpha1_types.html +++ b/docs/content/en/references/backups_v1alpha1_types.html @@ -67,19 +67,6 @@

Backup - - - - @@ -101,23 +99,21 @@

Backup

-storage
- - -BackupStorage - - -
-

Storage details where the backup data should be stored.

-
schedule
string @@ -88,6 +75,17 @@

Backup

(Optional)

Schedule defines when to run the Backup using a Cron expression. +A cron expression is a format used to specify the execution time of recurring tasks, consisting of multiple fields representing different time units. +┌───────────── minute (0 - 59) +│ ┌───────────── hour (0 - 23) +│ │ ┌───────────── day of the month (1 - 31) +│ │ │ ┌───────────── month (1 - 12) +│ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; +│ │ │ │ │ 7 is also Sunday on some systems) +│ │ │ │ │ +│ │ │ │ │

+
+

For example, “30 * * * *” represents execution at the 30th minute of every hour, and “10 10,14 * * *” represents execution at 10:10 AM and 2:10 PM every day. If not set, the backup will be executed only once.

-(Optional) -

Destination indicates the default clusters where backups should be executed. -Can be overridden by individual Policies.

+

Destination indicates the clusters where backups should be performed.

-policies
+policy
- -[]BackupSyncPolicy + +BackupPolicy
(Optional) -

Policies are the rules defining how backups should be performed.

+

Policy are the rules defining how backups should be performed.

@@ -139,14 +135,13 @@

Backup -

BackupPolicy +

BackupDetails

(Appears on: -BackupSyncPolicy) +BackupStatus, +MigrateStatus)

-

Note: partly copied from https://github.com/vmware-tanzu/velero/pkg/apis/backup_types.go -BackupSpec defines the specification for a backup.

@@ -159,73 +154,65 @@

BackupPolicy

-resourceFilter
+clusterName
- -ResourceFilter - +string
(Optional) -

ResourceFilter specifies which resources should be included in the backup. -It acts as a selective criterion to determine which resources are relevant for backup. -If not set, the backup process will consider all resources. This filter helps in optimizing the backup process by excluding unnecessary data.

+

ClusterName is the Name of the cluster where the backup is being performed.

-ttl
+clusterKind
- -Kubernetes meta/v1.Duration - +string
(Optional) -

TTL is a time.Duration-parseable string describing how long the Backup should be retained for.

+

ClusterKind is the kind of ClusterName recorded in Kurator.

-orderedResources
+backupNameInCluster
-map[string]string +string
(Optional) -

OrderedResources specifies the backup order of resources of specific Kind. -The map key is the resource name and value is a list of object names separated by commas. -Each resource name has format “namespace/objectname”. For cluster resources, simply use “objectname”.

+

BackupNameInCluster is the name of the backup being performed within this cluster. +This BackupNameInCluster is unique in Storage.

-itemOperationTimeout
+backupStatusInCluster
- -Kubernetes meta/v1.Duration - +github.com/vmware-tanzu/velero/pkg/apis/velero/v1.BackupStatus
(Optional) -

ItemOperationTimeout specifies the time used to wait for asynchronous BackupItemAction operations. -The default value is 1 hour.

+

BackupStatusInCluster is the current status of the backup performed within this cluster.

-

BackupSpec +

BackupPolicy

(Appears on: -Backup) +BackupSpec)

+

Note: partly copied from https://github.com/vmware-tanzu/velero/blob/v1.11.1/pkg/apis/velero/v1/backup_types.go +BackupPolicy defines the specification for a backup policy.

@@ -238,64 +225,59 @@

BackupSpec

- - - -
-storage
+resourceFilter
- -BackupStorage + +ResourceFilter
-

Storage details where the backup data should be stored.

-
-schedule
- -string - -
(Optional) -

Schedule defines when to run the Backup using a Cron expression. -If not set, the backup will be executed only once.

+

ResourceFilter specifies which resources should be included in the backup. +It acts as a selective criterion to determine which resources are relevant for backup. +If not set, the backup process will consider all resources. This filter helps in optimizing the backup process by excluding unnecessary data.

-destination
+ttl
- -Destination + +Kubernetes meta/v1.Duration
(Optional) -

Destination indicates the default clusters where backups should be executed. -Can be overridden by individual Policies.

+

TTL is a time.Duration-parseable string describing how long the Backup should be retained for.

-policies
+orderedResources
- -[]BackupSyncPolicy - +map[string]string
(Optional) -

Policies are the rules defining how backups should be performed.

+

OrderedResources specifies the backup order of resources of specific Kind. +The map key is the resource name and value is a list of object names separated by commas. +Each resource name has format “namespace/objectname”. For cluster resources, simply use “objectname”. +For example, if you have a specific order for pods, such as “pod1, pod2, pod3” with all belonging to the “ns1” namespace, +and a specific order for persistentvolumes, such as “pv4, pv8”, you can use the orderedResources field in YAML format as shown below:

+
orderedResources:
+pods: "ns1/pod1, ns1/pod2, ns1/pod3"
+persistentvolumes: "pv4, pv8"
+
-

BackupStatus +

BackupSpec

(Appears on: @@ -313,160 +295,64 @@

BackupStatus -conditions
- - -Cluster API /v1beta1.Conditions - - - - -(Optional) -

Conditions represent the current state of the backup operation.

- - - - -phase
+schedule
string (Optional) -

Phase represents the current phase of the backup operation.

- - - - -backupDetails
- -[]github.com/vmware-tanzu/velero/pkg/apis/velero/v1.BackupStatus - - - -(Optional) -

BackupDetails provides a detailed status for each backup in each cluster.

+

Schedule defines when to run the Backup using a Cron expression. +A cron expression is a format used to specify the execution time of recurring tasks, consisting of multiple fields representing different time units. +┌───────────── minute (0 - 59) +│ ┌───────────── hour (0 - 23) +│ │ ┌───────────── day of the month (1 - 31) +│ │ │ ┌───────────── month (1 - 12) +│ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; +│ │ │ │ │ 7 is also Sunday on some systems) +│ │ │ │ │ +│ │ │ │ │

+
+

For example, “30 * * * *” represents execution at the 30th minute of every hour, and “10 10,14 * * *” represents execution at 10:10 AM and 2:10 PM every day. +If not set, the backup will be executed only once.

- - - - -

BackupStorage -

-

-(Appears on: -BackupSpec, -MigrateSpec) -

-
-
- - - - - - - - - - - -
FieldDescription
-location
+destination
- -BackupStorageLocation + +Destination
-

Location specifies the location where the backup data will be stored.

+

Destination indicates the clusters where backups should be performed.

-credentials
- -string - -
-

Credentials to access the backup storage location.

-
-
-
-

BackupStorageLocation -

-

-(Appears on: -BackupStorage) -

-
-
- - - - - - - - - - - - - - - - - - - - - -
FieldDescription
-bucket
- -string - -
-

Bucket specifies the storage bucket name.

-
-provider
- -string - -
-

Provider specifies the storage provider type (e.g., aws).

-
-s3Url
- -string - -
-

S3Url provides the endpoint URL for S3-compatible storage.

-
-region
+policy
-string + +BackupPolicy +
-

Region specifies the region of the storage.

+(Optional) +

Policy are the rules defining how backups should be performed.

-

BackupSyncPolicy +

BackupStatus

(Appears on: -BackupSpec) +Backup)

@@ -480,46 +366,42 @@

BackupSyncPolicy -name
+conditions
-string + +Cluster API /v1beta1.Conditions + (Optional) -

Name of the BackupSyncPolicy. -If not provided, a default name will be generated. -This field is recommended for users to set, so that during the restore process, customized restoration can be performed based on this name.

+

Conditions represent the current state of the backup operation.

-destination
+phase
- -Destination - +string (Optional) -

Destination indicates where the backup should be executed.

+

Phase represents the current phase of the backup operation.

-policy
+backupDetails
- -BackupPolicy + +[]BackupDetails (Optional) -

Policy outlines the specific rules and filters applied during the backup process. -It determines which resources are selected for backup and any specific conditions or procedures to follow. -Users can customize this policy to ensure that the backup process aligns with their specific requirements and constraints.

+

Details provides a detailed status for each backup in each cluster.

@@ -528,10 +410,6 @@

BackupSyncPolicy

ClusterSelector

-

-(Appears on: -Destination) -

@@ -564,10 +442,10 @@

Destination

(Appears on: BackupSpec, -BackupSyncPolicy, -MigrateSpec) +MigrateSpec, +RestoreSpec)

-

Destination defines a fleet or specific clusters.

+

Destination defines a target set of clusters, either through a fleet or by specifying them directly.

@@ -586,22 +464,24 @@

Destination

@@ -648,19 +528,6 @@

Migrate

-

Fleet is the name of fleet.

+(Optional) +

Fleet represents the name of a fleet which determines a set of clusters. +If Fleet is set, it will be used to determine the target clusters. +If users wish to specify clusters directly, they can use the Clusters field.

-clusterSelector
+clusters
- -ClusterSelector + +[]Kubernetes core/v1.ObjectReference
(Optional) -

ClusterSelector specifies the selectors to select the clusters within the fleet. -If unspecified, all clusters in the fleet will be selected.

+

Clusters allows users to directly specify a set of destination clusters.

- - - - @@ -746,7 +615,7 @@

MigratePolicy

@@ -760,7 +629,13 @@

MigratePolicy (Optional)

OrderedResources specifies the backup order of resources of specific Kind. The map key is the resource name and value is a list of object names separated by commas. -Each resource name has format “namespace/objectname”. For cluster resources, simply use “objectname”.

+Each resource name has format “namespace/objectname”. For cluster resources, simply use “objectname”. +For example, if you have a specific order for pods, such as “pod1, pod2, pod3” with all belonging to the “ns1” namespace, +and a specific order for persistentvolumes, such as “pv4, pv8”, you can use the orderedResources field in YAML format as shown below:

+
orderedResources:
+pods: "ns1/pod1, ns1/pod2, ns1/pod3"
+persistentvolumes: "pv4, pv8"
+

@@ -780,8 +655,8 @@

MigratePolicy

@@ -803,21 +678,6 @@

MigratePolicy

PreserveNodePorts specifies whether to migrate old nodePorts from source cluster to target cluster.

- - - -
-storage
- - -BackupStorage - - -
-

Storage details where the data should be stored.

-
sourceCluster
@@ -669,7 +536,9 @@

Migrate

-

SourceCluster represents the source cluster for migration.

+

SourceCluster represents the source cluster for migration. +The user needs to ensure that SourceCluster points to only ONE cluster. +Because the current migration only supports migrating from one SourceCluster to one or more TargetCluster.

(Optional)

ResourceFilter specifies the resources to be included in the migration. -If not set, all resources in will be migrated.

+If not set, all resources in source cluster will be migrated.

migrateStatus
- -RestoreStatusSpec + +PreserveStatus
-itemOperationTimeout
- - -Kubernetes meta/v1.Duration - - -
-(Optional) -

ItemOperationTimeout specifies the time used to wait for RestoreItemAction operations. -The default value is 1 hour.

-
@@ -840,19 +700,6 @@

MigrateSpec -storage
- - -BackupStorage - - - - -

Storage details where the data should be stored.

- - - - sourceCluster
@@ -861,7 +708,9 @@

MigrateSpec -

SourceCluster represents the source cluster for migration.

+

SourceCluster represents the source cluster for migration. +The user needs to ensure that SourceCluster points to only ONE cluster. +Because the current migration only supports migrating from one SourceCluster to one or more TargetCluster.

@@ -941,7 +790,9 @@

MigrateStatus sourceClusterStatus
-github.com/vmware-tanzu/velero/pkg/apis/velero/v1.BackupStatus +
+BackupDetails + @@ -952,7 +803,9 @@

MigrateStatus targetClusterStatus
-[]github.com/vmware-tanzu/velero/pkg/apis/velero/v1.RestoreStatus + +[]RestoreDetails + @@ -963,6 +816,66 @@

MigrateStatus

+

PreserveStatus +

+

+(Appears on: +MigratePolicy, +RestorePolicy) +

+

PreserveStatus specifies which resources we should restore the status field. +The logic implemented is that everything in the included list except those items in the excluded list should be included. +‘*’ in the includes list means “include everything”, but it is not valid in the exclude list.

+
+
+ + + + + + + + + + + + + + + + + +
FieldDescription
+includedResources
+ +[]string + +
+(Optional) +

IncludedResources determines which resources will have their status restored. +By default, if this list is empty, it means the status for ALL resources will be restored. +For example: +- If you want to restore the status only for deployments and services, set: +includedResources: [“deployments”, “services”] +- If you leave it empty, the status for all resources will be restored. +Note: If a resource is listed in both IncludedResources and ExcludedResources, the exclusion takes precedence.

+
+excludedResources
+ +[]string + +
+(Optional) +

ExcludedResources lists out the resources that will NOT have their status restored. +By default, if this list is empty, it means the status for NO resources will be excluded from restoration. +For instance: +- If you want to prevent restoring the status for pods and configmaps, set: +excludedResources: [“pods”, “configmaps”] +- If you leave it empty, no resources are excluded, and all will have their status restored (unless specified otherwise in IncludedResources). +Note: Exclusions listed here take precedence over inclusions. So, if a resource is listed in both, its status will NOT be restored.

+
+
+

ResourceFilter

@@ -971,7 +884,7 @@

ResourceFilter MigratePolicy, RestorePolicy)

-

Note: partly copied from https://github.com/“github.com/vmware-tanzu/velero/pkg/apis/backup_types.go

+

Note: partly copied from https://github.com/vmware-tanzu/velero/blob/v1.11.1/pkg/apis/velero/v1/backup_types.go

@@ -991,7 +904,7 @@

ResourceFilter

@@ -1016,8 +929,10 @@

ResourceFilter

@@ -1029,7 +944,21 @@

ResourceFilter

+ + + + @@ -1042,8 +971,10 @@

ResourceFilter

@@ -1056,7 +987,8 @@

ResourceFilter

@@ -1069,7 +1001,9 @@

ResourceFilter

@@ -1082,7 +1016,8 @@

ResourceFilter

@@ -1116,18 +1051,6 @@

ResourceFilter LabelSelector as well as OrLabelSelectors cannot co-exist in backup request, only one of them can be used.

- - - -
(Optional) -

IncludedNamespaces is a slice of namespace names to include objects from. +

IncludedNamespaces is a list of namespace names to include objects from. If empty, all namespaces are included.

(Optional) -

IncludedResources is a slice of resource names to include in the backup. -If empty, all resources are included.

+

IncludedResources is a slice of API resource names to include in the backup. +For example, we can populate this string array with [“deployments”, “configmaps”,“clusterroles”,“storageclasses”], then we will select all resources of type deployments and configmaps. +If empty, all API resources are included. +Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources.

(Optional) -

ExcludedResources is a slice of resource names that are not included in the backup.

+

ExcludedResources is a slice of resource names that are not included in the backup. +Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources.

+
+includeClusterResources
+ +bool + +
+(Optional) +

IncludeClusterResources specifies whether cluster-scoped resources should be included for consideration in the backup. +Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources.

(Optional)

IncludedClusterScopedResources is a slice of cluster-scoped resource type names to include in the backup. +For example, we can populate this string array with [“storageclasses”, “clusterroles”], then we will select all resources of type storageclasses and clusterroles, If set to “*”, all cluster-scoped resource types are included. -The default value is empty, which means only related cluster-scoped resources are included.

+The default value is empty, which means only related cluster-scoped resources are included. +Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources.

(Optional)

ExcludedClusterScopedResources is a slice of cluster-scoped resource type names to exclude from the backup. -If set to “*”, all cluster-scoped resource types are excluded. The default value is empty.

+If set to “*”, all cluster-scoped resource types are excluded. The default value is empty. +Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources.

(Optional)

IncludedNamespaceScopedResources is a slice of namespace-scoped resource type names to include in the backup. -The default value is “*”.

+For example, we can populate this string array with [“deployments”, “configmaps”], then we will select all resources of type deployments and configmaps, +The default value is “*”. +Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources.

(Optional)

ExcludedNamespaceScopedResources is a slice of namespace-scoped resource type names to exclude from the backup. -If set to “*”, all namespace-scoped resource types are excluded. The default value is empty.

+If set to “*”, all namespace-scoped resource types are excluded. The default value is empty. +Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources.

-includeClusterResources
- -bool - -
-(Optional) -

IncludeClusterResources specifies whether cluster-scoped resources should be included for consideration in the backup.

-
@@ -1183,16 +1106,31 @@

Restore -policies
+destination
+ + +Destination + + + + +(Optional) +

Destination indicates the clusters where restore should be performed. +if not set, all the clusters from Backup.spec.destination will perform restore.

+ + + + +policy
- -[]RestoreSyncPolicy + +RestorePolicy (Optional) -

Policies defines the customization rules for the restore. +

Policy defines the customization rules for the restore. If null, the backup will be fully restored using default settings.

@@ -1215,14 +1153,13 @@

Restore

-

RestorePolicy +

RestoreDetails

(Appears on: -RestoreSyncPolicy) +MigrateStatus, +RestoreStatus)

-

Note: partly copied from https://github.com/vmware-tanzu/velero/pkg/apis/restore_types.go -RestorePolicy defines the specification for a Velero restore.

@@ -1235,86 +1172,65 @@

RestorePolicy

- - - -
-resourceFilter
+clusterName
- -ResourceFilter - - -
-(Optional) -

ResourceFilter is the filter for the resources to be restored. -If not set, all resources from the backup will be restored.

-
-namespaceMapping
- -map[string]string +string
(Optional) -

NamespaceMapping is a map of source namespace names -to target namespace names to restore into. -Any source namespaces not included in the map will be restored into -namespaces of the same name.

+

ClusterName is the Name of the cluster where the restore is being performed.

-restoreStatus
+clusterKind
- -RestoreStatusSpec - +string
(Optional) -

RestoreStatus specifies which resources we should restore the status field. -If nil, no objects are included.

+

ClusterKind is the kind of ClusterName recorded in Kurator.

-preserveNodePorts
+restoreNameInCluster
-bool +string
(Optional) -

PreserveNodePorts specifies whether to restore old nodePorts from backup.

+

RestoreNameInCluster is the name of the restore being performed within this cluster. +This RestoreNameInCluster is unique in Storage.

-itemOperationTimeout
+restoreStatusInCluster
- -Kubernetes meta/v1.Duration - +github.com/vmware-tanzu/velero/pkg/apis/velero/v1.RestoreStatus
(Optional) -

ItemOperationTimeout specifies the time used to wait for RestoreItemAction operations. -The default value is 1 hour.

+

RestoreStatusInCluster is the current status of the restore performed within this cluster.

-

RestoreSpec +

RestorePolicy

(Appears on: -Restore) +RestoreSpec)

+

Note: partly copied from https://github.com/vmware-tanzu/velero/blob/v1.11.1/pkg/apis/velero/v1/restore_types.go +RestorePolicy defines the specification for a Velero restore.

@@ -1327,98 +1243,71 @@

RestoreSpec

- - - - - -
-backupName
- -string - -
-

BackupName specifies the backup on which this restore operation is based.

-
-policies
+resourceFilter
- -[]RestoreSyncPolicy + +ResourceFilter
(Optional) -

Policies defines the customization rules for the restore. -If null, the backup will be fully restored using default settings.

+

ResourceFilter is the filter for the resources to be restored. +If not set, all resources from the backup will be restored.

-
-
-

RestoreStatus -

-

-(Appears on: -Restore) -

-
-
- - - - - - - -
FieldDescription
-conditions
+namespaceMapping
- -Cluster API /v1beta1.Conditions - +map[string]string
(Optional) -

Conditions represent the current state of the restore operation.

+

NamespaceMapping is a map of source namespace names +to target namespace names to restore into. +Any source namespaces not included in the map will be restored into +namespaces of the same name.

-phase
+preserveStatus
-string + +PreserveStatus +
(Optional) -

Phase represents the current phase of the restore operation.

+

PreserveStatus specifies which resources we should restore the status field. +If unset, no status will be restored.

-restoreDetails
+preserveNodePorts
-[]github.com/vmware-tanzu/velero/pkg/apis/velero/v1.RestoreStatus +bool
(Optional) -

RestoreDetails provides a detailed status for each restore in each cluster.

+

PreserveNodePorts specifies whether to restore old nodePorts from backup. +If not specified, default to false.

-

RestoreStatusSpec +

RestoreSpec

(Appears on: -MigratePolicy, -RestorePolicy) +Restore)

@@ -1432,38 +1321,54 @@

RestoreStatusSpec -includedResources
+backupName
-[]string +string + + + +

BackupName specifies the backup on which this restore operation is based.

+ + + + +destination
+ + +Destination + (Optional) -

IncludedResources specifies the resources to which will restore the status. -If empty, it applies to all resources.

+

Destination indicates the clusters where restore should be performed. +if not set, all the clusters from Backup.spec.destination will perform restore.

-excludedResources
+policy
-[]string + +RestorePolicy + (Optional) -

ExcludedResources specifies the resources to which will not restore the status.

+

Policy defines the customization rules for the restore. +If null, the backup will be fully restored using default settings.

-

RestoreSyncPolicy +

RestoreStatus

(Appears on: -RestoreSpec) +Restore)

@@ -1477,30 +1382,42 @@

RestoreSyncPolicy -name
+conditions
+ + +Cluster API /v1beta1.Conditions + + + + +(Optional) +

Conditions represent the current state of the restore operation.

+ + + + +phase
string -

Name is the unique identifier for this restore policy. It should match the name in the backup policy. -to ensure the restore policy corresponds to the correct backup policy. -If a name provided by the user doesn’t match any backup policy, the restore operation will fail -and return a clear error message.

+(Optional) +

Phase represents the current phase of the restore operation.

-policy
+restoreDetails
- -RestorePolicy + +[]RestoreDetails (Optional) -

Policy indicates the rules and filters for the restore.

+

Details provides a detailed status for each restore in each cluster.

diff --git a/manifests/charts/fleet-manager/crds/backup.kurator.dev_backups.yaml b/manifests/charts/fleet-manager/crds/backup.kurator.dev_backups.yaml index 7d552f134..e3a9f1506 100644 --- a/manifests/charts/fleet-manager/crds/backup.kurator.dev_backups.yaml +++ b/manifests/charts/fleet-manager/crds/backup.kurator.dev_backups.yaml @@ -47,452 +47,467 @@ spec: spec: properties: destination: - description: Destination indicates the default clusters where backups - should be executed. Can be overridden by individual Policies. + description: Destination indicates the clusters where backups should + be performed. properties: - clusterSelector: - description: ClusterSelector specifies the selectors to select - the clusters within the fleet. If unspecified, all clusters - in the fleet will be selected. - properties: - matchLabels: - additionalProperties: + clusters: + description: Clusters allows users to directly specify a set of + destination clusters. + items: + description: "ObjectReference contains enough information to + let you inspect or modify the referred object. --- New uses + of this type are discouraged because of difficulty describing + its usage when embedded in APIs. 1. Ignored fields. It includes + many fields which are not generally honored. For instance, + ResourceVersion and FieldPath are both very rarely valid in + actual usage. 2. Invalid usage help. It is impossible to + add specific help for individual usage. In most embedded + usages, there are particular restrictions like, \"must refer + only to types A and B\" or \"UID not honored\" or \"name must + be restricted\". Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, + the validation rules are different by usage, which makes it + hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency + is on the group,resource tuple and the version of the actual + struct is irrelevant. 5. We cannot easily change it. Because + this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an + underspecified API type they do not control. \n Instead of + using this type, create a locally provided and used type that + is well-focused on your reference. For example, ServiceReferences + for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. type: string - description: 'MatchLabels is a map of {key,value} pairs. A - single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is "key", - the operator is "In", and the values array contains only - "value". More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors' - type: object - type: object + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + type: array fleet: - description: Fleet is the name of fleet. + description: Fleet represents the name of a fleet which determines + a set of clusters. If Fleet is set, it will be used to determine + the target clusters. If users wish to specify clusters directly, + they can use the Clusters field. type: string - required: - - fleet type: object - policies: - description: Policies are the rules defining how backups should be - performed. - items: - properties: - destination: - description: Destination indicates where the backup should be - executed. - properties: - clusterSelector: - description: ClusterSelector specifies the selectors to - select the clusters within the fleet. If unspecified, - all clusters in the fleet will be selected. - properties: - matchLabels: - additionalProperties: - type: string - description: 'MatchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field - is "key", the operator is "In", and the values array - contains only "value". More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors' - type: object - type: object - fleet: - description: Fleet is the name of fleet. - type: string - required: - - fleet - type: object - name: - description: Name of the BackupSyncPolicy. If not provided, - a default name will be generated. This field is recommended - for users to set, so that during the restore process, customized - restoration can be performed based on this name. + policy: + description: Policy are the rules defining how backups should be performed. + properties: + orderedResources: + additionalProperties: type: string - policy: - description: Policy outlines the specific rules and filters - applied during the backup process. It determines which resources - are selected for backup and any specific conditions or procedures - to follow. Users can customize this policy to ensure that - the backup process aligns with their specific requirements - and constraints. - properties: - itemOperationTimeout: - description: ItemOperationTimeout specifies the time used - to wait for asynchronous BackupItemAction operations. - The default value is 1 hour. + description: 'OrderedResources specifies the backup order of resources + of specific Kind. The map key is the resource name and value + is a list of object names separated by commas. Each resource + name has format "namespace/objectname". For cluster resources, + simply use "objectname". For example, if you have a specific + order for pods, such as "pod1, pod2, pod3" with all belonging + to the "ns1" namespace, and a specific order for persistentvolumes, + such as "pv4, pv8", you can use the orderedResources field in + YAML format as shown below: ```yaml orderedResources: pods: + "ns1/pod1, ns1/pod2, ns1/pod3" persistentvolumes: "pv4, pv8" + ```' + nullable: true + type: object + resourceFilter: + description: ResourceFilter specifies which resources should be + included in the backup. It acts as a selective criterion to + determine which resources are relevant for backup. If not set, + the backup process will consider all resources. This filter + helps in optimizing the backup process by excluding unnecessary + data. + properties: + excludedClusterScopedResources: + description: ExcludedClusterScopedResources is a slice of + cluster-scoped resource type names to exclude from the backup. + If set to "*", all cluster-scoped resource types are excluded. + The default value is empty. Cannot work with IncludedResources, + ExcludedResources and IncludeClusterResources. + items: type: string - orderedResources: - additionalProperties: - type: string - description: OrderedResources specifies the backup order - of resources of specific Kind. The map key is the resource - name and value is a list of object names separated by - commas. Each resource name has format "namespace/objectname". For - cluster resources, simply use "objectname". - nullable: true - type: object - resourceFilter: - description: ResourceFilter specifies which resources should - be included in the backup. It acts as a selective criterion - to determine which resources are relevant for backup. - If not set, the backup process will consider all resources. - This filter helps in optimizing the backup process by - excluding unnecessary data. - properties: - excludedClusterScopedResources: - description: ExcludedClusterScopedResources is a slice - of cluster-scoped resource type names to exclude from - the backup. If set to "*", all cluster-scoped resource - types are excluded. The default value is empty. - items: - type: string - nullable: true - type: array - excludedNamespaceScopedResources: - description: ExcludedNamespaceScopedResources is a slice - of namespace-scoped resource type names to exclude - from the backup. If set to "*", all namespace-scoped - resource types are excluded. The default value is - empty. - items: - type: string - nullable: true - type: array - excludedNamespaces: - description: ExcludedNamespaces contains a list of namespaces - that are not included in the backup. - items: - type: string - nullable: true - type: array - excludedResources: - description: ExcludedResources is a slice of resource - names that are not included in the backup. - items: - type: string - nullable: true - type: array - includeClusterResources: - description: IncludeClusterResources specifies whether - cluster-scoped resources should be included for consideration - in the backup. - nullable: true - type: boolean - includedClusterScopedResources: - description: IncludedClusterScopedResources is a slice - of cluster-scoped resource type names to include in - the backup. If set to "*", all cluster-scoped resource - types are included. The default value is empty, which - means only related cluster-scoped resources are included. - items: - type: string - nullable: true - type: array - includedNamespaceScopedResources: - description: IncludedNamespaceScopedResources is a slice - of namespace-scoped resource type names to include - in the backup. The default value is "*". - items: - type: string - nullable: true - type: array - includedNamespaces: - description: IncludedNamespaces is a slice of namespace - names to include objects from. If empty, all namespaces - are included. - items: - type: string - nullable: true - type: array - includedResources: - description: IncludedResources is a slice of resource - names to include in the backup. If empty, all resources - are included. - items: - type: string - nullable: true - type: array - labelSelector: - description: LabelSelector is a metav1.LabelSelector - to filter with when adding individual objects to the - backup. If empty or nil, all objects are included. - Optional. - nullable: true + nullable: true + type: array + excludedNamespaceScopedResources: + description: ExcludedNamespaceScopedResources is a slice of + namespace-scoped resource type names to exclude from the + backup. If set to "*", all namespace-scoped resource types + are excluded. The default value is empty. Cannot work with + IncludedResources, ExcludedResources and IncludeClusterResources. + items: + type: string + nullable: true + type: array + excludedNamespaces: + description: ExcludedNamespaces contains a list of namespaces + that are not included in the backup. + items: + type: string + nullable: true + type: array + excludedResources: + description: ExcludedResources is a slice of resource names + that are not included in the backup. Cannot work with IncludedClusterScopedResources, + ExcludedClusterScopedResources, IncludedNamespaceScopedResources + and ExcludedNamespaceScopedResources. + items: + type: string + nullable: true + type: array + includeClusterResources: + description: IncludeClusterResources specifies whether cluster-scoped + resources should be included for consideration in the backup. + Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, + IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. + nullable: true + type: boolean + includedClusterScopedResources: + description: IncludedClusterScopedResources is a slice of + cluster-scoped resource type names to include in the backup. + For example, we can populate this string array with ["storageclasses", + "clusterroles"], then we will select all resources of type + storageclasses and clusterroles, If set to "*", all cluster-scoped + resource types are included. The default value is empty, + which means only related cluster-scoped resources are included. + Cannot work with IncludedResources, ExcludedResources and + IncludeClusterResources. + items: + type: string + nullable: true + type: array + includedNamespaceScopedResources: + description: IncludedNamespaceScopedResources is a slice of + namespace-scoped resource type names to include in the backup. + For example, we can populate this string array with ["deployments", + "configmaps"], then we will select all resources of type + deployments and configmaps, The default value is "*". Cannot + work with IncludedResources, ExcludedResources and IncludeClusterResources. + items: + type: string + nullable: true + type: array + includedNamespaces: + description: IncludedNamespaces is a list of namespace names + to include objects from. If empty, all namespaces are included. + items: + type: string + nullable: true + type: array + includedResources: + description: IncludedResources is a slice of API resource + names to include in the backup. For example, we can populate + this string array with ["deployments", "configmaps","clusterroles","storageclasses"], + then we will select all resources of type deployments and + configmaps. If empty, all API resources are included. Cannot + work with IncludedClusterScopedResources, ExcludedClusterScopedResources, + IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. + items: + type: string + nullable: true + type: array + labelSelector: + description: LabelSelector is a metav1.LabelSelector to filter + with when adding individual objects to the backup. If empty + or nil, all objects are included. Optional. + nullable: true + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. - type: object + type: array + required: + - key + - operator type: object - orLabelSelectors: - description: OrLabelSelectors is list of metav1.LabelSelector - to filter with when adding individual objects to the - backup. If multiple provided they will be joined by - the OR operator. LabelSelector as well as OrLabelSelectors - cannot co-exist in backup request, only one of them - can be used. + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + orLabelSelectors: + description: OrLabelSelectors is list of metav1.LabelSelector + to filter with when adding individual objects to the backup. + If multiple provided they will be joined by the OR operator. + LabelSelector as well as OrLabelSelectors cannot co-exist + in backup request, only one of them can be used. + items: + description: A label selector is a label query over a set + of resources. The result of matchLabels and matchExpressions + are ANDed. An empty label selector matches all objects. + A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. items: - description: A label selector is a label query over - a set of resources. The result of matchLabels and - matchExpressions are ANDed. An empty label selector - matches all objects. A null label selector matches - no objects. + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, + NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists + or DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. items: - description: A label selector requirement is - a selector that contains values, a key, and - an operator that relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. This array - is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". - The requirements are ANDed. - type: object + type: array + required: + - key + - operator type: object - nullable: true type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field + is "key", the operator is "In", and the values array + contains only "value". The requirements are ANDed. + type: object type: object - ttl: - description: TTL is a time.Duration-parseable string describing - how long the Backup should be retained for. - type: string - type: object - type: object - type: array + nullable: true + type: array + type: object + ttl: + description: TTL is a time.Duration-parseable string describing + how long the Backup should be retained for. + type: string + type: object schedule: description: Schedule defines when to run the Backup using a Cron - expression. If not set, the backup will be executed only once. + expression. A cron expression is a format used to specify the execution + time of recurring tasks, consisting of multiple fields representing + different time units. ┌───────────── minute (0 - 59) │ ┌───────────── + hour (0 - 23) │ │ ┌───────────── day of the month (1 - 31) │ │ │ + ┌───────────── month (1 - 12) │ │ │ │ ┌───────────── day of the + week (0 - 6) (Sunday to Saturday; │ │ │ │ │ 7 + is also Sunday on some systems) │ │ │ │ │ │ │ │ │ │ * * * * * For + example, "30 * * * *" represents execution at the 30th minute of + every hour, and "10 10,14 * * *" represents execution at 10:10 AM + and 2:10 PM every day. If not set, the backup will be executed only + once. type: string - storage: - description: Storage details where the backup data should be stored. - properties: - credentials: - description: Credentials to access the backup storage location. - type: string - location: - description: Location specifies the location where the backup - data will be stored. - properties: - bucket: - description: Bucket specifies the storage bucket name. - type: string - provider: - description: Provider specifies the storage provider type - (e.g., aws). - type: string - region: - description: Region specifies the region of the storage. - type: string - s3Url: - description: S3Url provides the endpoint URL for S3-compatible - storage. - type: string - required: - - bucket - - provider - - region - - s3Url - type: object - required: - - credentials - - location - type: object required: - - storage + - destination type: object status: properties: backupDetails: - description: BackupDetails provides a detailed status for each backup - in each cluster. + description: Details provides a detailed status for each backup in + each cluster. items: - description: BackupStatus captures the current status of a Velero - backup. properties: - backupItemOperationsAttempted: - description: BackupItemOperationsAttempted is the total number - of attempted async BackupItemAction operations for this backup. - type: integer - backupItemOperationsCompleted: - description: BackupItemOperationsCompleted is the total number - of successfully completed async BackupItemAction operations - for this backup. - type: integer - backupItemOperationsFailed: - description: BackupItemOperationsFailed is the total number - of async BackupItemAction operations for this backup which - ended with an error. - type: integer - completionTimestamp: - description: CompletionTimestamp records the time a backup was - completed. Completion time is recorded even on failed backups. - Completion time is recorded before uploading the backup object. - The server's time is used for CompletionTimestamps - format: date-time - nullable: true - type: string - csiVolumeSnapshotsAttempted: - description: CSIVolumeSnapshotsAttempted is the total number - of attempted CSI VolumeSnapshots for this backup. - type: integer - csiVolumeSnapshotsCompleted: - description: CSIVolumeSnapshotsCompleted is the total number - of successfully completed CSI VolumeSnapshots for this backup. - type: integer - errors: - description: Errors is a count of all error messages that were - generated during execution of the backup. The actual errors - are in the backup's log file in object storage. - type: integer - expiration: - description: Expiration is when this Backup is eligible for - garbage-collection. - format: date-time - nullable: true - type: string - failureReason: - description: FailureReason is an error that caused the entire - backup to fail. + backupNameInCluster: + description: BackupNameInCluster is the name of the backup being + performed within this cluster. This BackupNameInCluster is + unique in Storage. type: string - formatVersion: - description: FormatVersion is the backup format version, including - major, minor, and patch version. - type: string - phase: - description: Phase is the current state of the Backup. - enum: - - New - - FailedValidation - - InProgress - - WaitingForPluginOperations - - WaitingForPluginOperationsPartiallyFailed - - Finalizing - - FinalizingPartiallyFailed - - Completed - - PartiallyFailed - - Failed - - Deleting - type: string - progress: - description: Progress contains information about the backup's - execution progress. Note that this information is best-effort - only -- if Velero fails to update it during a backup for any - reason, it may be inaccurate/stale. - nullable: true + backupStatusInCluster: + description: BackupStatusInCluster is the current status of + the backup performed within this cluster. properties: - itemsBackedUp: - description: ItemsBackedUp is the number of items that have - actually been written to the backup tarball so far. + backupItemOperationsAttempted: + description: BackupItemOperationsAttempted is the total + number of attempted async BackupItemAction operations + for this backup. + type: integer + backupItemOperationsCompleted: + description: BackupItemOperationsCompleted is the total + number of successfully completed async BackupItemAction + operations for this backup. + type: integer + backupItemOperationsFailed: + description: BackupItemOperationsFailed is the total number + of async BackupItemAction operations for this backup which + ended with an error. + type: integer + completionTimestamp: + description: CompletionTimestamp records the time a backup + was completed. Completion time is recorded even on failed + backups. Completion time is recorded before uploading + the backup object. The server's time is used for CompletionTimestamps + format: date-time + nullable: true + type: string + csiVolumeSnapshotsAttempted: + description: CSIVolumeSnapshotsAttempted is the total number + of attempted CSI VolumeSnapshots for this backup. + type: integer + csiVolumeSnapshotsCompleted: + description: CSIVolumeSnapshotsCompleted is the total number + of successfully completed CSI VolumeSnapshots for this + backup. + type: integer + errors: + description: Errors is a count of all error messages that + were generated during execution of the backup. The actual + errors are in the backup's log file in object storage. + type: integer + expiration: + description: Expiration is when this Backup is eligible + for garbage-collection. + format: date-time + nullable: true + type: string + failureReason: + description: FailureReason is an error that caused the entire + backup to fail. + type: string + formatVersion: + description: FormatVersion is the backup format version, + including major, minor, and patch version. + type: string + phase: + description: Phase is the current state of the Backup. + enum: + - New + - FailedValidation + - InProgress + - WaitingForPluginOperations + - WaitingForPluginOperationsPartiallyFailed + - Finalizing + - FinalizingPartiallyFailed + - Completed + - PartiallyFailed + - Failed + - Deleting + type: string + progress: + description: Progress contains information about the backup's + execution progress. Note that this information is best-effort + only -- if Velero fails to update it during a backup for + any reason, it may be inaccurate/stale. + nullable: true + properties: + itemsBackedUp: + description: ItemsBackedUp is the number of items that + have actually been written to the backup tarball so + far. + type: integer + totalItems: + description: TotalItems is the total number of items + to be backed up. This number may change throughout + the execution of the backup due to plugins that return + additional related items to back up, the velero.io/exclude-from-backup + label, and various other filters that happen as items + are processed. + type: integer + type: object + startTimestamp: + description: StartTimestamp records the time a backup was + started. Separate from CreationTimestamp, since that value + changes on restores. The server's time is used for StartTimestamps + format: date-time + nullable: true + type: string + validationErrors: + description: ValidationErrors is a slice of all validation + errors (if applicable). + items: + type: string + nullable: true + type: array + version: + description: 'Version is the backup format major version. + Deprecated: Please see FormatVersion' + type: integer + volumeSnapshotsAttempted: + description: VolumeSnapshotsAttempted is the total number + of attempted volume snapshots for this backup. type: integer - totalItems: - description: TotalItems is the total number of items to - be backed up. This number may change throughout the execution - of the backup due to plugins that return additional related - items to back up, the velero.io/exclude-from-backup label, - and various other filters that happen as items are processed. + volumeSnapshotsCompleted: + description: VolumeSnapshotsCompleted is the total number + of successfully completed volume snapshots for this backup. + type: integer + warnings: + description: Warnings is a count of all warning messages + that were generated during execution of the backup. The + actual warnings are in the backup's log file in object + storage. type: integer type: object - startTimestamp: - description: StartTimestamp records the time a backup was started. - Separate from CreationTimestamp, since that value changes - on restores. The server's time is used for StartTimestamps - format: date-time - nullable: true + clusterKind: + description: ClusterKind is the kind of ClusterName recorded + in Kurator. + type: string + clusterName: + description: ClusterName is the Name of the cluster where the + backup is being performed. type: string - validationErrors: - description: ValidationErrors is a slice of all validation errors - (if applicable). - items: - type: string - nullable: true - type: array - version: - description: 'Version is the backup format major version. Deprecated: - Please see FormatVersion' - type: integer - volumeSnapshotsAttempted: - description: VolumeSnapshotsAttempted is the total number of - attempted volume snapshots for this backup. - type: integer - volumeSnapshotsCompleted: - description: VolumeSnapshotsCompleted is the total number of - successfully completed volume snapshots for this backup. - type: integer - warnings: - description: Warnings is a count of all warning messages that - were generated during execution of the backup. The actual - warnings are in the backup's log file in object storage. - type: integer type: object type: array conditions: diff --git a/manifests/charts/fleet-manager/crds/backup.kurator.dev_migrates.yaml b/manifests/charts/fleet-manager/crds/backup.kurator.dev_migrates.yaml index 6be100827..d4e134e89 100644 --- a/manifests/charts/fleet-manager/crds/backup.kurator.dev_migrates.yaml +++ b/manifests/charts/fleet-manager/crds/backup.kurator.dev_migrates.yaml @@ -44,26 +44,37 @@ spec: policy: description: Policy defines the rules for the migration. properties: - itemOperationTimeout: - description: ItemOperationTimeout specifies the time used to wait - for RestoreItemAction operations. The default value is 1 hour. - type: string migrateStatus: description: MigrateStatus specifies which resources we should migrate the status field. If nil, no objects are included. Optional. nullable: true properties: excludedResources: - description: ExcludedResources specifies the resources to - which will not restore the status. + description: 'ExcludedResources lists out the resources that + will NOT have their status restored. By default, if this + list is empty, it means the status for NO resources will + be excluded from restoration. For instance: - If you want + to prevent restoring the status for pods and configmaps, + set: excludedResources: ["pods", "configmaps"] - If you + leave it empty, no resources are excluded, and all will + have their status restored (unless specified otherwise in + IncludedResources). Note: Exclusions listed here take precedence + over inclusions. So, if a resource is listed in both, its + status will NOT be restored.' items: type: string nullable: true type: array includedResources: - description: IncludedResources specifies the resources to - which will restore the status. If empty, it applies to all - resources. + description: 'IncludedResources determines which resources + will have their status restored. By default, if this list + is empty, it means the status for ALL resources will be + restored. For example: - If you want to restore the status + only for deployments and services, set: includedResources: + ["deployments", "services"] - If you leave it empty, the + status for all resources will be restored. Note: If a resource + is listed in both IncludedResources and ExcludedResources, + the exclusion takes precedence.' items: type: string nullable: true @@ -80,11 +91,17 @@ spec: orderedResources: additionalProperties: type: string - description: OrderedResources specifies the backup order of resources + description: "OrderedResources specifies the backup order of resources of specific Kind. The map key is the resource name and value is a list of object names separated by commas. Each resource - name has format "namespace/objectname". For cluster resources, - simply use "objectname". + name has format \"namespace/objectname\". For cluster resources, + simply use \"objectname\". For example, if you have a specific + order for pods, such as \"pod1, pod2, pod3\" with all belonging + to the \"ns1\" namespace, and a specific order for persistentvolumes, + such as \"pv4, pv8\", you can use the orderedResources field + in YAML format as shown below: \n ```yaml orderedResources: + pods: \"ns1/pod1, ns1/pod2, ns1/pod3\" persistentvolumes: \"pv4, + pv8\" ```" nullable: true type: object preserveNodePorts: @@ -94,13 +111,15 @@ spec: type: boolean resourceFilter: description: ResourceFilter specifies the resources to be included - in the migration. If not set, all resources in will be migrated. + in the migration. If not set, all resources in source cluster + will be migrated. properties: excludedClusterScopedResources: description: ExcludedClusterScopedResources is a slice of cluster-scoped resource type names to exclude from the backup. If set to "*", all cluster-scoped resource types are excluded. - The default value is empty. + The default value is empty. Cannot work with IncludedResources, + ExcludedResources and IncludeClusterResources. items: type: string nullable: true @@ -109,7 +128,8 @@ spec: description: ExcludedNamespaceScopedResources is a slice of namespace-scoped resource type names to exclude from the backup. If set to "*", all namespace-scoped resource types - are excluded. The default value is empty. + are excluded. The default value is empty. Cannot work with + IncludedResources, ExcludedResources and IncludeClusterResources. items: type: string nullable: true @@ -123,7 +143,9 @@ spec: type: array excludedResources: description: ExcludedResources is a slice of resource names - that are not included in the backup. + that are not included in the backup. Cannot work with IncludedClusterScopedResources, + ExcludedClusterScopedResources, IncludedNamespaceScopedResources + and ExcludedNamespaceScopedResources. items: type: string nullable: true @@ -131,14 +153,20 @@ spec: includeClusterResources: description: IncludeClusterResources specifies whether cluster-scoped resources should be included for consideration in the backup. + Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, + IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. nullable: true type: boolean includedClusterScopedResources: description: IncludedClusterScopedResources is a slice of cluster-scoped resource type names to include in the backup. - If set to "*", all cluster-scoped resource types are included. - The default value is empty, which means only related cluster-scoped - resources are included. + For example, we can populate this string array with ["storageclasses", + "clusterroles"], then we will select all resources of type + storageclasses and clusterroles, If set to "*", all cluster-scoped + resource types are included. The default value is empty, + which means only related cluster-scoped resources are included. + Cannot work with IncludedResources, ExcludedResources and + IncludeClusterResources. items: type: string nullable: true @@ -146,21 +174,29 @@ spec: includedNamespaceScopedResources: description: IncludedNamespaceScopedResources is a slice of namespace-scoped resource type names to include in the backup. - The default value is "*". + For example, we can populate this string array with ["deployments", + "configmaps"], then we will select all resources of type + deployments and configmaps, The default value is "*". Cannot + work with IncludedResources, ExcludedResources and IncludeClusterResources. items: type: string nullable: true type: array includedNamespaces: - description: IncludedNamespaces is a slice of namespace names + description: IncludedNamespaces is a list of namespace names to include objects from. If empty, all namespaces are included. items: type: string nullable: true type: array includedResources: - description: IncludedResources is a slice of resource names - to include in the backup. If empty, all resources are included. + description: IncludedResources is a slice of API resource + names to include in the backup. For example, we can populate + this string array with ["deployments", "configmaps","clusterroles","storageclasses"], + then we will select all resources of type deployments and + configmaps. If empty, all API resources are included. Cannot + work with IncludedClusterScopedResources, ExcludedClusterScopedResources, + IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. items: type: string nullable: true @@ -273,89 +309,161 @@ spec: type: object sourceCluster: description: SourceCluster represents the source cluster for migration. + The user needs to ensure that SourceCluster points to only ONE cluster. + Because the current migration only supports migrating from one SourceCluster + to one or more TargetCluster. properties: - clusterSelector: - description: ClusterSelector specifies the selectors to select - the clusters within the fleet. If unspecified, all clusters - in the fleet will be selected. - properties: - matchLabels: - additionalProperties: + clusters: + description: Clusters allows users to directly specify a set of + destination clusters. + items: + description: "ObjectReference contains enough information to + let you inspect or modify the referred object. --- New uses + of this type are discouraged because of difficulty describing + its usage when embedded in APIs. 1. Ignored fields. It includes + many fields which are not generally honored. For instance, + ResourceVersion and FieldPath are both very rarely valid in + actual usage. 2. Invalid usage help. It is impossible to + add specific help for individual usage. In most embedded + usages, there are particular restrictions like, \"must refer + only to types A and B\" or \"UID not honored\" or \"name must + be restricted\". Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, + the validation rules are different by usage, which makes it + hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency + is on the group,resource tuple and the version of the actual + struct is irrelevant. 5. We cannot easily change it. Because + this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an + underspecified API type they do not control. \n Instead of + using this type, create a locally provided and used type that + is well-focused on your reference. For example, ServiceReferences + for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. type: string - description: 'MatchLabels is a map of {key,value} pairs. A - single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is "key", - the operator is "In", and the values array contains only - "value". More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors' - type: object - type: object + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + type: array fleet: - description: Fleet is the name of fleet. + description: Fleet represents the name of a fleet which determines + a set of clusters. If Fleet is set, it will be used to determine + the target clusters. If users wish to specify clusters directly, + they can use the Clusters field. type: string - required: - - fleet - type: object - storage: - description: Storage details where the data should be stored. - properties: - credentials: - description: Credentials to access the backup storage location. - type: string - location: - description: Location specifies the location where the backup - data will be stored. - properties: - bucket: - description: Bucket specifies the storage bucket name. - type: string - provider: - description: Provider specifies the storage provider type - (e.g., aws). - type: string - region: - description: Region specifies the region of the storage. - type: string - s3Url: - description: S3Url provides the endpoint URL for S3-compatible - storage. - type: string - required: - - bucket - - provider - - region - - s3Url - type: object - required: - - credentials - - location type: object targetCluster: description: TargetCluster represents the target clusters for migration. properties: - clusterSelector: - description: ClusterSelector specifies the selectors to select - the clusters within the fleet. If unspecified, all clusters - in the fleet will be selected. - properties: - matchLabels: - additionalProperties: + clusters: + description: Clusters allows users to directly specify a set of + destination clusters. + items: + description: "ObjectReference contains enough information to + let you inspect or modify the referred object. --- New uses + of this type are discouraged because of difficulty describing + its usage when embedded in APIs. 1. Ignored fields. It includes + many fields which are not generally honored. For instance, + ResourceVersion and FieldPath are both very rarely valid in + actual usage. 2. Invalid usage help. It is impossible to + add specific help for individual usage. In most embedded + usages, there are particular restrictions like, \"must refer + only to types A and B\" or \"UID not honored\" or \"name must + be restricted\". Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, + the validation rules are different by usage, which makes it + hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency + is on the group,resource tuple and the version of the actual + struct is irrelevant. 5. We cannot easily change it. Because + this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an + underspecified API type they do not control. \n Instead of + using this type, create a locally provided and used type that + is well-focused on your reference. For example, ServiceReferences + for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. type: string - description: 'MatchLabels is a map of {key,value} pairs. A - single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is "key", - the operator is "In", and the values array contains only - "value". More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors' - type: object - type: object + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + type: array fleet: - description: Fleet is the name of fleet. + description: Fleet represents the name of a fleet which determines + a set of clusters. If Fleet is set, it will be used to determine + the target clusters. If users wish to specify clusters directly, + they can use the Clusters field. type: string - required: - - fleet type: object required: - sourceCluster - - storage - targetCluster type: object status: @@ -413,205 +521,244 @@ spec: description: SourceClusterStatus provides a detailed status for backup in SourceCluster. properties: - backupItemOperationsAttempted: - description: BackupItemOperationsAttempted is the total number - of attempted async BackupItemAction operations for this backup. - type: integer - backupItemOperationsCompleted: - description: BackupItemOperationsCompleted is the total number - of successfully completed async BackupItemAction operations - for this backup. - type: integer - backupItemOperationsFailed: - description: BackupItemOperationsFailed is the total number of - async BackupItemAction operations for this backup which ended - with an error. - type: integer - completionTimestamp: - description: CompletionTimestamp records the time a backup was - completed. Completion time is recorded even on failed backups. - Completion time is recorded before uploading the backup object. - The server's time is used for CompletionTimestamps - format: date-time - nullable: true + backupNameInCluster: + description: BackupNameInCluster is the name of the backup being + performed within this cluster. This BackupNameInCluster is unique + in Storage. type: string - csiVolumeSnapshotsAttempted: - description: CSIVolumeSnapshotsAttempted is the total number of - attempted CSI VolumeSnapshots for this backup. - type: integer - csiVolumeSnapshotsCompleted: - description: CSIVolumeSnapshotsCompleted is the total number of - successfully completed CSI VolumeSnapshots for this backup. - type: integer - errors: - description: Errors is a count of all error messages that were - generated during execution of the backup. The actual errors - are in the backup's log file in object storage. - type: integer - expiration: - description: Expiration is when this Backup is eligible for garbage-collection. - format: date-time - nullable: true - type: string - failureReason: - description: FailureReason is an error that caused the entire - backup to fail. - type: string - formatVersion: - description: FormatVersion is the backup format version, including - major, minor, and patch version. - type: string - phase: - description: Phase is the current state of the Backup. - enum: - - New - - FailedValidation - - InProgress - - WaitingForPluginOperations - - WaitingForPluginOperationsPartiallyFailed - - Finalizing - - FinalizingPartiallyFailed - - Completed - - PartiallyFailed - - Failed - - Deleting - type: string - progress: - description: Progress contains information about the backup's - execution progress. Note that this information is best-effort - only -- if Velero fails to update it during a backup for any - reason, it may be inaccurate/stale. - nullable: true + backupStatusInCluster: + description: BackupStatusInCluster is the current status of the + backup performed within this cluster. properties: - itemsBackedUp: - description: ItemsBackedUp is the number of items that have - actually been written to the backup tarball so far. + backupItemOperationsAttempted: + description: BackupItemOperationsAttempted is the total number + of attempted async BackupItemAction operations for this + backup. type: integer - totalItems: - description: TotalItems is the total number of items to be - backed up. This number may change throughout the execution - of the backup due to plugins that return additional related - items to back up, the velero.io/exclude-from-backup label, - and various other filters that happen as items are processed. + backupItemOperationsCompleted: + description: BackupItemOperationsCompleted is the total number + of successfully completed async BackupItemAction operations + for this backup. + type: integer + backupItemOperationsFailed: + description: BackupItemOperationsFailed is the total number + of async BackupItemAction operations for this backup which + ended with an error. + type: integer + completionTimestamp: + description: CompletionTimestamp records the time a backup + was completed. Completion time is recorded even on failed + backups. Completion time is recorded before uploading the + backup object. The server's time is used for CompletionTimestamps + format: date-time + nullable: true + type: string + csiVolumeSnapshotsAttempted: + description: CSIVolumeSnapshotsAttempted is the total number + of attempted CSI VolumeSnapshots for this backup. + type: integer + csiVolumeSnapshotsCompleted: + description: CSIVolumeSnapshotsCompleted is the total number + of successfully completed CSI VolumeSnapshots for this backup. + type: integer + errors: + description: Errors is a count of all error messages that + were generated during execution of the backup. The actual + errors are in the backup's log file in object storage. + type: integer + expiration: + description: Expiration is when this Backup is eligible for + garbage-collection. + format: date-time + nullable: true + type: string + failureReason: + description: FailureReason is an error that caused the entire + backup to fail. + type: string + formatVersion: + description: FormatVersion is the backup format version, including + major, minor, and patch version. + type: string + phase: + description: Phase is the current state of the Backup. + enum: + - New + - FailedValidation + - InProgress + - WaitingForPluginOperations + - WaitingForPluginOperationsPartiallyFailed + - Finalizing + - FinalizingPartiallyFailed + - Completed + - PartiallyFailed + - Failed + - Deleting + type: string + progress: + description: Progress contains information about the backup's + execution progress. Note that this information is best-effort + only -- if Velero fails to update it during a backup for + any reason, it may be inaccurate/stale. + nullable: true + properties: + itemsBackedUp: + description: ItemsBackedUp is the number of items that + have actually been written to the backup tarball so + far. + type: integer + totalItems: + description: TotalItems is the total number of items to + be backed up. This number may change throughout the + execution of the backup due to plugins that return additional + related items to back up, the velero.io/exclude-from-backup + label, and various other filters that happen as items + are processed. + type: integer + type: object + startTimestamp: + description: StartTimestamp records the time a backup was + started. Separate from CreationTimestamp, since that value + changes on restores. The server's time is used for StartTimestamps + format: date-time + nullable: true + type: string + validationErrors: + description: ValidationErrors is a slice of all validation + errors (if applicable). + items: + type: string + nullable: true + type: array + version: + description: 'Version is the backup format major version. + Deprecated: Please see FormatVersion' + type: integer + volumeSnapshotsAttempted: + description: VolumeSnapshotsAttempted is the total number + of attempted volume snapshots for this backup. + type: integer + volumeSnapshotsCompleted: + description: VolumeSnapshotsCompleted is the total number + of successfully completed volume snapshots for this backup. + type: integer + warnings: + description: Warnings is a count of all warning messages that + were generated during execution of the backup. The actual + warnings are in the backup's log file in object storage. type: integer type: object - startTimestamp: - description: StartTimestamp records the time a backup was started. - Separate from CreationTimestamp, since that value changes on - restores. The server's time is used for StartTimestamps - format: date-time - nullable: true + clusterKind: + description: ClusterKind is the kind of ClusterName recorded in + Kurator. + type: string + clusterName: + description: ClusterName is the Name of the cluster where the + backup is being performed. type: string - validationErrors: - description: ValidationErrors is a slice of all validation errors - (if applicable). - items: - type: string - nullable: true - type: array - version: - description: 'Version is the backup format major version. Deprecated: - Please see FormatVersion' - type: integer - volumeSnapshotsAttempted: - description: VolumeSnapshotsAttempted is the total number of attempted - volume snapshots for this backup. - type: integer - volumeSnapshotsCompleted: - description: VolumeSnapshotsCompleted is the total number of successfully - completed volume snapshots for this backup. - type: integer - warnings: - description: Warnings is a count of all warning messages that - were generated during execution of the backup. The actual warnings - are in the backup's log file in object storage. - type: integer type: object targetClusterStatus: description: TargetClusterStatus provides a detailed status for each restore in each TargetCluster. items: - description: RestoreStatus captures the current status of a Velero - restore properties: - completionTimestamp: - description: CompletionTimestamp records the time the restore - operation was completed. Completion time is recorded even - on failed restore. The server's time is used for StartTimestamps - format: date-time - nullable: true + clusterKind: + description: ClusterKind is the kind of ClusterName recorded + in Kurator. type: string - errors: - description: Errors is a count of all error messages that were - generated during execution of the restore. The actual errors - are stored in object storage. - type: integer - failureReason: - description: FailureReason is an error that caused the entire - restore to fail. + clusterName: + description: ClusterName is the Name of the cluster where the + restore is being performed. type: string - phase: - description: Phase is the current state of the Restore - enum: - - New - - FailedValidation - - InProgress - - WaitingForPluginOperations - - WaitingForPluginOperationsPartiallyFailed - - Completed - - PartiallyFailed - - Failed + restoreNameInCluster: + description: RestoreNameInCluster is the name of the restore + being performed within this cluster. This RestoreNameInCluster + is unique in Storage. type: string - progress: - description: Progress contains information about the restore's - execution progress. Note that this information is best-effort - only -- if Velero fails to update it during a restore for - any reason, it may be inaccurate/stale. - nullable: true + restoreStatusInCluster: + description: RestoreStatusInCluster is the current status of + the restore performed within this cluster. properties: - itemsRestored: - description: ItemsRestored is the number of items that have - actually been restored so far + completionTimestamp: + description: CompletionTimestamp records the time the restore + operation was completed. Completion time is recorded even + on failed restore. The server's time is used for StartTimestamps + format: date-time + nullable: true + type: string + errors: + description: Errors is a count of all error messages that + were generated during execution of the restore. The actual + errors are stored in object storage. type: integer - totalItems: - description: TotalItems is the total number of items to - be restored. This number may change throughout the execution - of the restore due to plugins that return additional related - items to restore + failureReason: + description: FailureReason is an error that caused the entire + restore to fail. + type: string + phase: + description: Phase is the current state of the Restore + enum: + - New + - FailedValidation + - InProgress + - WaitingForPluginOperations + - WaitingForPluginOperationsPartiallyFailed + - Completed + - PartiallyFailed + - Failed + type: string + progress: + description: Progress contains information about the restore's + execution progress. Note that this information is best-effort + only -- if Velero fails to update it during a restore + for any reason, it may be inaccurate/stale. + nullable: true + properties: + itemsRestored: + description: ItemsRestored is the number of items that + have actually been restored so far + type: integer + totalItems: + description: TotalItems is the total number of items + to be restored. This number may change throughout + the execution of the restore due to plugins that return + additional related items to restore + type: integer + type: object + restoreItemOperationsAttempted: + description: RestoreItemOperationsAttempted is the total + number of attempted async RestoreItemAction operations + for this restore. + type: integer + restoreItemOperationsCompleted: + description: RestoreItemOperationsCompleted is the total + number of successfully completed async RestoreItemAction + operations for this restore. + type: integer + restoreItemOperationsFailed: + description: RestoreItemOperationsFailed is the total number + of async RestoreItemAction operations for this restore + which ended with an error. + type: integer + startTimestamp: + description: StartTimestamp records the time the restore + operation was started. The server's time is used for StartTimestamps + format: date-time + nullable: true + type: string + validationErrors: + description: ValidationErrors is a slice of all validation + errors (if applicable) + items: + type: string + nullable: true + type: array + warnings: + description: Warnings is a count of all warning messages + that were generated during execution of the restore. The + actual warnings are stored in object storage. type: integer type: object - restoreItemOperationsAttempted: - description: RestoreItemOperationsAttempted is the total number - of attempted async RestoreItemAction operations for this restore. - type: integer - restoreItemOperationsCompleted: - description: RestoreItemOperationsCompleted is the total number - of successfully completed async RestoreItemAction operations - for this restore. - type: integer - restoreItemOperationsFailed: - description: RestoreItemOperationsFailed is the total number - of async RestoreItemAction operations for this restore which - ended with an error. - type: integer - startTimestamp: - description: StartTimestamp records the time the restore operation - was started. The server's time is used for StartTimestamps - format: date-time - nullable: true - type: string - validationErrors: - description: ValidationErrors is a slice of all validation errors - (if applicable) - items: - type: string - nullable: true - type: array - warnings: - description: Warnings is a count of all warning messages that - were generated during execution of the restore. The actual - warnings are stored in object storage. - type: integer type: object type: array type: object diff --git a/manifests/charts/fleet-manager/crds/backup.kurator.dev_restores.yaml b/manifests/charts/fleet-manager/crds/backup.kurator.dev_restores.yaml index b099bbe65..923a2024b 100644 --- a/manifests/charts/fleet-manager/crds/backup.kurator.dev_restores.yaml +++ b/manifests/charts/fleet-manager/crds/backup.kurator.dev_restores.yaml @@ -45,257 +45,335 @@ spec: description: BackupName specifies the backup on which this restore operation is based. type: string - policies: - description: Policies defines the customization rules for the restore. + destination: + description: Destination indicates the clusters where restore should + be performed. if not set, all the clusters from Backup.spec.destination + will perform restore. + properties: + clusters: + description: Clusters allows users to directly specify a set of + destination clusters. + items: + description: "ObjectReference contains enough information to + let you inspect or modify the referred object. --- New uses + of this type are discouraged because of difficulty describing + its usage when embedded in APIs. 1. Ignored fields. It includes + many fields which are not generally honored. For instance, + ResourceVersion and FieldPath are both very rarely valid in + actual usage. 2. Invalid usage help. It is impossible to + add specific help for individual usage. In most embedded + usages, there are particular restrictions like, \"must refer + only to types A and B\" or \"UID not honored\" or \"name must + be restricted\". Those cannot be well described when embedded. + 3. Inconsistent validation. Because the usages are different, + the validation rules are different by usage, which makes it + hard for users to predict what will happen. 4. The fields + are both imprecise and overly precise. Kind is not a precise + mapping to a URL. This can produce ambiguity during interpretation + and require a REST mapping. In most cases, the dependency + is on the group,resource tuple and the version of the actual + struct is irrelevant. 5. We cannot easily change it. Because + this type is embedded in many locations, updates to this type + will affect numerous schemas. Don't make new APIs embed an + underspecified API type they do not control. \n Instead of + using this type, create a locally provided and used type that + is well-focused on your reference. For example, ServiceReferences + for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 + ." + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + type: array + fleet: + description: Fleet represents the name of a fleet which determines + a set of clusters. If Fleet is set, it will be used to determine + the target clusters. If users wish to specify clusters directly, + they can use the Clusters field. + type: string + type: object + policy: + description: Policy defines the customization rules for the restore. If null, the backup will be fully restored using default settings. - items: - properties: - name: - description: Name is the unique identifier for this restore - policy. It should match the name in the backup policy. to - ensure the restore policy corresponds to the correct backup - policy. If a name provided by the user doesn't match any backup - policy, the restore operation will fail and return a clear - error message. + properties: + namespaceMapping: + additionalProperties: type: string - policy: - description: Policy indicates the rules and filters for the - restore. - properties: - itemOperationTimeout: - description: ItemOperationTimeout specifies the time used - to wait for RestoreItemAction operations. The default - value is 1 hour. + description: NamespaceMapping is a map of source namespace names + to target namespace names to restore into. Any source namespaces + not included in the map will be restored into namespaces of + the same name. + type: object + preserveNodePorts: + description: PreserveNodePorts specifies whether to restore old + nodePorts from backup. If not specified, default to false. + nullable: true + type: boolean + preserveStatus: + description: PreserveStatus specifies which resources we should + restore the status field. If unset, no status will be restored. + nullable: true + properties: + excludedResources: + description: 'ExcludedResources lists out the resources that + will NOT have their status restored. By default, if this + list is empty, it means the status for NO resources will + be excluded from restoration. For instance: - If you want + to prevent restoring the status for pods and configmaps, + set: excludedResources: ["pods", "configmaps"] - If you + leave it empty, no resources are excluded, and all will + have their status restored (unless specified otherwise in + IncludedResources). Note: Exclusions listed here take precedence + over inclusions. So, if a resource is listed in both, its + status will NOT be restored.' + items: type: string - namespaceMapping: - additionalProperties: - type: string - description: NamespaceMapping is a map of source namespace - names to target namespace names to restore into. Any source - namespaces not included in the map will be restored into - namespaces of the same name. - type: object - preserveNodePorts: - description: PreserveNodePorts specifies whether to restore - old nodePorts from backup. - nullable: true - type: boolean - resourceFilter: - description: ResourceFilter is the filter for the resources - to be restored. If not set, all resources from the backup - will be restored. - properties: - excludedClusterScopedResources: - description: ExcludedClusterScopedResources is a slice - of cluster-scoped resource type names to exclude from - the backup. If set to "*", all cluster-scoped resource - types are excluded. The default value is empty. - items: - type: string - nullable: true - type: array - excludedNamespaceScopedResources: - description: ExcludedNamespaceScopedResources is a slice - of namespace-scoped resource type names to exclude - from the backup. If set to "*", all namespace-scoped - resource types are excluded. The default value is - empty. - items: - type: string - nullable: true - type: array - excludedNamespaces: - description: ExcludedNamespaces contains a list of namespaces - that are not included in the backup. - items: - type: string - nullable: true - type: array - excludedResources: - description: ExcludedResources is a slice of resource - names that are not included in the backup. - items: - type: string - nullable: true - type: array - includeClusterResources: - description: IncludeClusterResources specifies whether - cluster-scoped resources should be included for consideration - in the backup. - nullable: true - type: boolean - includedClusterScopedResources: - description: IncludedClusterScopedResources is a slice - of cluster-scoped resource type names to include in - the backup. If set to "*", all cluster-scoped resource - types are included. The default value is empty, which - means only related cluster-scoped resources are included. - items: - type: string - nullable: true - type: array - includedNamespaceScopedResources: - description: IncludedNamespaceScopedResources is a slice - of namespace-scoped resource type names to include - in the backup. The default value is "*". - items: - type: string - nullable: true - type: array - includedNamespaces: - description: IncludedNamespaces is a slice of namespace - names to include objects from. If empty, all namespaces - are included. - items: - type: string - nullable: true - type: array - includedResources: - description: IncludedResources is a slice of resource - names to include in the backup. If empty, all resources - are included. - items: - type: string - nullable: true - type: array - labelSelector: - description: LabelSelector is a metav1.LabelSelector - to filter with when adding individual objects to the - backup. If empty or nil, all objects are included. - Optional. - nullable: true + nullable: true + type: array + includedResources: + description: 'IncludedResources determines which resources + will have their status restored. By default, if this list + is empty, it means the status for ALL resources will be + restored. For example: - If you want to restore the status + only for deployments and services, set: includedResources: + ["deployments", "services"] - If you leave it empty, the + status for all resources will be restored. Note: If a resource + is listed in both IncludedResources and ExcludedResources, + the exclusion takes precedence.' + items: + type: string + nullable: true + type: array + type: object + resourceFilter: + description: ResourceFilter is the filter for the resources to + be restored. If not set, all resources from the backup will + be restored. + properties: + excludedClusterScopedResources: + description: ExcludedClusterScopedResources is a slice of + cluster-scoped resource type names to exclude from the backup. + If set to "*", all cluster-scoped resource types are excluded. + The default value is empty. Cannot work with IncludedResources, + ExcludedResources and IncludeClusterResources. + items: + type: string + nullable: true + type: array + excludedNamespaceScopedResources: + description: ExcludedNamespaceScopedResources is a slice of + namespace-scoped resource type names to exclude from the + backup. If set to "*", all namespace-scoped resource types + are excluded. The default value is empty. Cannot work with + IncludedResources, ExcludedResources and IncludeClusterResources. + items: + type: string + nullable: true + type: array + excludedNamespaces: + description: ExcludedNamespaces contains a list of namespaces + that are not included in the backup. + items: + type: string + nullable: true + type: array + excludedResources: + description: ExcludedResources is a slice of resource names + that are not included in the backup. Cannot work with IncludedClusterScopedResources, + ExcludedClusterScopedResources, IncludedNamespaceScopedResources + and ExcludedNamespaceScopedResources. + items: + type: string + nullable: true + type: array + includeClusterResources: + description: IncludeClusterResources specifies whether cluster-scoped + resources should be included for consideration in the backup. + Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, + IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. + nullable: true + type: boolean + includedClusterScopedResources: + description: IncludedClusterScopedResources is a slice of + cluster-scoped resource type names to include in the backup. + For example, we can populate this string array with ["storageclasses", + "clusterroles"], then we will select all resources of type + storageclasses and clusterroles, If set to "*", all cluster-scoped + resource types are included. The default value is empty, + which means only related cluster-scoped resources are included. + Cannot work with IncludedResources, ExcludedResources and + IncludeClusterResources. + items: + type: string + nullable: true + type: array + includedNamespaceScopedResources: + description: IncludedNamespaceScopedResources is a slice of + namespace-scoped resource type names to include in the backup. + For example, we can populate this string array with ["deployments", + "configmaps"], then we will select all resources of type + deployments and configmaps, The default value is "*". Cannot + work with IncludedResources, ExcludedResources and IncludeClusterResources. + items: + type: string + nullable: true + type: array + includedNamespaces: + description: IncludedNamespaces is a list of namespace names + to include objects from. If empty, all namespaces are included. + items: + type: string + nullable: true + type: array + includedResources: + description: IncludedResources is a slice of API resource + names to include in the backup. For example, we can populate + this string array with ["deployments", "configmaps","clusterroles","storageclasses"], + then we will select all resources of type deployments and + configmaps. If empty, all API resources are included. Cannot + work with IncludedClusterScopedResources, ExcludedClusterScopedResources, + IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. + items: + type: string + nullable: true + type: array + labelSelector: + description: LabelSelector is a metav1.LabelSelector to filter + with when adding individual objects to the backup. If empty + or nil, all objects are included. Optional. + nullable: true + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are ANDed. + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, NotIn, + Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists or + DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. items: - description: A label selector requirement is a - selector that contains values, a key, and an - operator that relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are - In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If the - operator is Exists or DoesNotExist, the - values array must be empty. This array is - replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". The - requirements are ANDed. - type: object + type: array + required: + - key + - operator type: object - orLabelSelectors: - description: OrLabelSelectors is list of metav1.LabelSelector - to filter with when adding individual objects to the - backup. If multiple provided they will be joined by - the OR operator. LabelSelector as well as OrLabelSelectors - cannot co-exist in backup request, only one of them - can be used. + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field is + "key", the operator is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + orLabelSelectors: + description: OrLabelSelectors is list of metav1.LabelSelector + to filter with when adding individual objects to the backup. + If multiple provided they will be joined by the OR operator. + LabelSelector as well as OrLabelSelectors cannot co-exist + in backup request, only one of them can be used. + items: + description: A label selector is a label query over a set + of resources. The result of matchLabels and matchExpressions + are ANDed. An empty label selector matches all objects. + A null label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. items: - description: A label selector is a label query over - a set of resources. The result of matchLabels and - matchExpressions are ANDed. An empty label selector - matches all objects. A null label selector matches - no objects. + description: A label selector requirement is a selector + that contains values, a key, and an operator that + relates the key and values. properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are In, + NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. + If the operator is In or NotIn, the values array + must be non-empty. If the operator is Exists + or DoesNotExist, the values array must be empty. + This array is replaced during a strategic merge + patch. items: - description: A label selector requirement is - a selector that contains values, a key, and - an operator that relates the key and values. - properties: - key: - description: key is the label key that the - selector applies to. - type: string - operator: - description: operator represents a key's - relationship to a set of values. Valid - operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string - values. If the operator is In or NotIn, - the values array must be non-empty. If - the operator is Exists or DoesNotExist, - the values array must be empty. This array - is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: type: string - description: matchLabels is a map of {key,value} - pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, - whose key field is "key", the operator is "In", - and the values array contains only "value". - The requirements are ANDed. - type: object + type: array + required: + - key + - operator type: object - nullable: true type: array - type: object - restoreStatus: - description: RestoreStatus specifies which resources we - should restore the status field. If nil, no objects are - included. - nullable: true - properties: - excludedResources: - description: ExcludedResources specifies the resources - to which will not restore the status. - items: + matchLabels: + additionalProperties: type: string - nullable: true - type: array - includedResources: - description: IncludedResources specifies the resources - to which will restore the status. If empty, it applies - to all resources. - items: - type: string - nullable: true - type: array + description: matchLabels is a map of {key,value} pairs. + A single {key,value} in the matchLabels map is equivalent + to an element of matchExpressions, whose key field + is "key", the operator is "In", and the values array + contains only "value". The requirements are ANDed. + type: object type: object - type: object - required: - - name - type: object - type: array + nullable: true + type: array + type: object + type: object required: - backupName type: object @@ -351,90 +429,107 @@ spec: description: Phase represents the current phase of the restore operation. type: string restoreDetails: - description: RestoreDetails provides a detailed status for each restore - in each cluster. + description: Details provides a detailed status for each restore in + each cluster. items: - description: RestoreStatus captures the current status of a Velero - restore properties: - completionTimestamp: - description: CompletionTimestamp records the time the restore - operation was completed. Completion time is recorded even - on failed restore. The server's time is used for StartTimestamps - format: date-time - nullable: true + clusterKind: + description: ClusterKind is the kind of ClusterName recorded + in Kurator. type: string - errors: - description: Errors is a count of all error messages that were - generated during execution of the restore. The actual errors - are stored in object storage. - type: integer - failureReason: - description: FailureReason is an error that caused the entire - restore to fail. + clusterName: + description: ClusterName is the Name of the cluster where the + restore is being performed. type: string - phase: - description: Phase is the current state of the Restore - enum: - - New - - FailedValidation - - InProgress - - WaitingForPluginOperations - - WaitingForPluginOperationsPartiallyFailed - - Completed - - PartiallyFailed - - Failed + restoreNameInCluster: + description: RestoreNameInCluster is the name of the restore + being performed within this cluster. This RestoreNameInCluster + is unique in Storage. type: string - progress: - description: Progress contains information about the restore's - execution progress. Note that this information is best-effort - only -- if Velero fails to update it during a restore for - any reason, it may be inaccurate/stale. - nullable: true + restoreStatusInCluster: + description: RestoreStatusInCluster is the current status of + the restore performed within this cluster. properties: - itemsRestored: - description: ItemsRestored is the number of items that have - actually been restored so far + completionTimestamp: + description: CompletionTimestamp records the time the restore + operation was completed. Completion time is recorded even + on failed restore. The server's time is used for StartTimestamps + format: date-time + nullable: true + type: string + errors: + description: Errors is a count of all error messages that + were generated during execution of the restore. The actual + errors are stored in object storage. type: integer - totalItems: - description: TotalItems is the total number of items to - be restored. This number may change throughout the execution - of the restore due to plugins that return additional related - items to restore + failureReason: + description: FailureReason is an error that caused the entire + restore to fail. + type: string + phase: + description: Phase is the current state of the Restore + enum: + - New + - FailedValidation + - InProgress + - WaitingForPluginOperations + - WaitingForPluginOperationsPartiallyFailed + - Completed + - PartiallyFailed + - Failed + type: string + progress: + description: Progress contains information about the restore's + execution progress. Note that this information is best-effort + only -- if Velero fails to update it during a restore + for any reason, it may be inaccurate/stale. + nullable: true + properties: + itemsRestored: + description: ItemsRestored is the number of items that + have actually been restored so far + type: integer + totalItems: + description: TotalItems is the total number of items + to be restored. This number may change throughout + the execution of the restore due to plugins that return + additional related items to restore + type: integer + type: object + restoreItemOperationsAttempted: + description: RestoreItemOperationsAttempted is the total + number of attempted async RestoreItemAction operations + for this restore. + type: integer + restoreItemOperationsCompleted: + description: RestoreItemOperationsCompleted is the total + number of successfully completed async RestoreItemAction + operations for this restore. + type: integer + restoreItemOperationsFailed: + description: RestoreItemOperationsFailed is the total number + of async RestoreItemAction operations for this restore + which ended with an error. + type: integer + startTimestamp: + description: StartTimestamp records the time the restore + operation was started. The server's time is used for StartTimestamps + format: date-time + nullable: true + type: string + validationErrors: + description: ValidationErrors is a slice of all validation + errors (if applicable) + items: + type: string + nullable: true + type: array + warnings: + description: Warnings is a count of all warning messages + that were generated during execution of the restore. The + actual warnings are stored in object storage. type: integer type: object - restoreItemOperationsAttempted: - description: RestoreItemOperationsAttempted is the total number - of attempted async RestoreItemAction operations for this restore. - type: integer - restoreItemOperationsCompleted: - description: RestoreItemOperationsCompleted is the total number - of successfully completed async RestoreItemAction operations - for this restore. - type: integer - restoreItemOperationsFailed: - description: RestoreItemOperationsFailed is the total number - of async RestoreItemAction operations for this restore which - ended with an error. - type: integer - startTimestamp: - description: StartTimestamp records the time the restore operation - was started. The server's time is used for StartTimestamps - format: date-time - nullable: true - type: string - validationErrors: - description: ValidationErrors is a slice of all validation errors - (if applicable) - items: - type: string - nullable: true - type: array - warnings: - description: Warnings is a count of all warning messages that - were generated during execution of the restore. The actual - warnings are stored in object storage. - type: integer type: object type: array type: object diff --git a/pkg/apis/backups/v1alpha1/backup_type.go b/pkg/apis/backups/v1alpha1/backup_type.go index 2b2ee91c2..791288af3 100644 --- a/pkg/apis/backups/v1alpha1/backup_type.go +++ b/pkg/apis/backups/v1alpha1/backup_type.go @@ -39,63 +39,33 @@ type Backup struct { } type BackupSpec struct { - // Storage details where the backup data should be stored. - Storage BackupStorage `json:"storage"` - // Schedule defines when to run the Backup using a Cron expression. + // A cron expression is a format used to specify the execution time of recurring tasks, consisting of multiple fields representing different time units. + // ┌───────────── minute (0 - 59) + // │ ┌───────────── hour (0 - 23) + // │ │ ┌───────────── day of the month (1 - 31) + // │ │ │ ┌───────────── month (1 - 12) + // │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; + // │ │ │ │ │ 7 is also Sunday on some systems) + // │ │ │ │ │ + // │ │ │ │ │ + // * * * * * + // For example, "30 * * * *" represents execution at the 30th minute of every hour, and "10 10,14 * * *" represents execution at 10:10 AM and 2:10 PM every day. // If not set, the backup will be executed only once. // +optional Schedule string `json:"schedule,omitempty"` - // Destination indicates the default clusters where backups should be executed. - // Can be overridden by individual Policies. - // +optional - Destination *Destination `json:"destination,omitempty"` + // Destination indicates the clusters where backups should be performed. + // +required + Destination Destination `json:"destination"` - // Policies are the rules defining how backups should be performed. + // Policy are the rules defining how backups should be performed. // +optional - Policies []*BackupSyncPolicy `json:"policies,omitempty"` -} - -type BackupStorage struct { - // Location specifies the location where the backup data will be stored. - Location BackupStorageLocation `json:"location"` - - // Credentials to access the backup storage location. - Credentials string `json:"credentials"` -} - -type BackupStorageLocation struct { - // Bucket specifies the storage bucket name. - Bucket string `json:"bucket"` - // Provider specifies the storage provider type (e.g., aws). - Provider string `json:"provider"` - // S3Url provides the endpoint URL for S3-compatible storage. - S3Url string `json:"s3Url"` - // Region specifies the region of the storage. - Region string `json:"region"` + Policy *BackupPolicy `json:"policy,omitempty"` } -type BackupSyncPolicy struct { - // Name of the BackupSyncPolicy. - // If not provided, a default name will be generated. - // This field is recommended for users to set, so that during the restore process, customized restoration can be performed based on this name. - // +optional - Name string `json:"name,omitempty"` - - // Destination indicates where the backup should be executed. - // +optional - Destination Destination `json:"destination,omitempty"` - - // Policy outlines the specific rules and filters applied during the backup process. - // It determines which resources are selected for backup and any specific conditions or procedures to follow. - // Users can customize this policy to ensure that the backup process aligns with their specific requirements and constraints. - // +optional - Policy BackupPolicy `json:"policy,omitempty"` -} - -// Note: partly copied from https://github.com/vmware-tanzu/velero/pkg/apis/backup_types.go -// BackupSpec defines the specification for a backup. +// Note: partly copied from https://github.com/vmware-tanzu/velero/blob/v1.11.1/pkg/apis/velero/v1/backup_types.go +// BackupPolicy defines the specification for a backup policy. type BackupPolicy struct { // ResourceFilter specifies which resources should be included in the backup. // It acts as a selective criterion to determine which resources are relevant for backup. @@ -103,6 +73,8 @@ type BackupPolicy struct { // +optional ResourceFilter *ResourceFilter `json:"resourceFilter,omitempty"` + // TODO: support volume snapshot + // TTL is a time.Duration-parseable string describing how long the Backup should be retained for. // +optional TTL metav1.Duration `json:"ttl,omitempty"` @@ -110,14 +82,16 @@ type BackupPolicy struct { // OrderedResources specifies the backup order of resources of specific Kind. // The map key is the resource name and value is a list of object names separated by commas. // Each resource name has format "namespace/objectname". For cluster resources, simply use "objectname". + // For example, if you have a specific order for pods, such as "pod1, pod2, pod3" with all belonging to the "ns1" namespace, + // and a specific order for persistentvolumes, such as "pv4, pv8", you can use the orderedResources field in YAML format as shown below: + // ```yaml + // orderedResources: + // pods: "ns1/pod1, ns1/pod2, ns1/pod3" + // persistentvolumes: "pv4, pv8" + // ``` // +optional // +nullable OrderedResources map[string]string `json:"orderedResources,omitempty"` - - // ItemOperationTimeout specifies the time used to wait for asynchronous BackupItemAction operations. - // The default value is 1 hour. - // +optional - ItemOperationTimeout metav1.Duration `json:"itemOperationTimeout,omitempty"` } type BackupStatus struct { @@ -129,7 +103,35 @@ type BackupStatus struct { // +optional Phase string `json:"phase,omitempty"` - // BackupDetails provides a detailed status for each backup in each cluster. + // Details provides a detailed status for each backup in each cluster. + // +optional + Details []*BackupDetails `json:"backupDetails,omitempty"` +} + +type BackupDetails struct { + // ClusterName is the Name of the cluster where the backup is being performed. + // +optional + ClusterName string `json:"clusterName,omitempty"` + + // ClusterKind is the kind of ClusterName recorded in Kurator. // +optional - BackupDetails []*velerov1.BackupStatus `json:"backupDetails,omitempty"` + ClusterKind string `json:"clusterKind,omitempty"` + + // BackupNameInCluster is the name of the backup being performed within this cluster. + // This BackupNameInCluster is unique in Storage. + // +optional + BackupNameInCluster string `json:"backupNameInCluster,omitempty"` + + // BackupStatusInCluster is the current status of the backup performed within this cluster. + // +optional + BackupStatusInCluster *velerov1.BackupStatus `json:"backupStatusInCluster,omitempty"` +} + +// BackupList contains a list of Backup. +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BackupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Backup `json:"items"` } diff --git a/pkg/apis/backups/v1alpha1/util.go b/pkg/apis/backups/v1alpha1/common_type.go similarity index 63% rename from pkg/apis/backups/v1alpha1/util.go rename to pkg/apis/backups/v1alpha1/common_type.go index 00136746a..41827e932 100644 --- a/pkg/apis/backups/v1alpha1/util.go +++ b/pkg/apis/backups/v1alpha1/common_type.go @@ -16,17 +16,22 @@ limitations under the License. package v1alpha1 -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) -// Destination defines a fleet or specific clusters. +// Destination defines a target set of clusters, either through a fleet or by specifying them directly. type Destination struct { - // Fleet is the name of fleet. - // +required - Fleet string `json:"fleet"` - // ClusterSelector specifies the selectors to select the clusters within the fleet. - // If unspecified, all clusters in the fleet will be selected. + // Fleet represents the name of a fleet which determines a set of clusters. + // If Fleet is set, it will be used to determine the target clusters. + // If users wish to specify clusters directly, they can use the Clusters field. // +optional - ClusterSelector *ClusterSelector `json:"clusterSelector,omitempty"` + Fleet string `json:"fleet,omitempty"` + + // Clusters allows users to directly specify a set of destination clusters. + // +optional + Clusters []*corev1.ObjectReference `json:"clusters,omitempty"` } type ClusterSelector struct { @@ -36,9 +41,9 @@ type ClusterSelector struct { MatchLabels map[string]string `json:"matchLabels,omitempty"` } -// Note: partly copied from https://github.com/"github.com/vmware-tanzu/velero/pkg/apis/backup_types.go +// Note: partly copied from https://github.com/vmware-tanzu/velero/blob/v1.11.1/pkg/apis/velero/v1/backup_types.go type ResourceFilter struct { - // IncludedNamespaces is a slice of namespace names to include objects from. + // IncludedNamespaces is a list of namespace names to include objects from. // If empty, all namespaces are included. // +optional // +nullable @@ -49,38 +54,53 @@ type ResourceFilter struct { // +nullable ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"` - // IncludedResources is a slice of resource names to include in the backup. - // If empty, all resources are included. + // IncludedResources is a slice of API resource names to include in the backup. + // For example, we can populate this string array with ["deployments", "configmaps","clusterroles","storageclasses"], then we will select all resources of type deployments and configmaps. + // If empty, all API resources are included. + // Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. // +optional // +nullable IncludedResources []string `json:"includedResources,omitempty"` // ExcludedResources is a slice of resource names that are not included in the backup. + // Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. // +optional // +nullable ExcludedResources []string `json:"excludedResources,omitempty"` + // IncludeClusterResources specifies whether cluster-scoped resources should be included for consideration in the backup. + // Cannot work with IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources. + // +optional + // +nullable + IncludeClusterResources *bool `json:"includeClusterResources,omitempty"` + // IncludedClusterScopedResources is a slice of cluster-scoped resource type names to include in the backup. + // For example, we can populate this string array with ["storageclasses", "clusterroles"], then we will select all resources of type storageclasses and clusterroles, // If set to "*", all cluster-scoped resource types are included. // The default value is empty, which means only related cluster-scoped resources are included. + // Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources. // +optional // +nullable IncludedClusterScopedResources []string `json:"includedClusterScopedResources,omitempty"` // ExcludedClusterScopedResources is a slice of cluster-scoped resource type names to exclude from the backup. // If set to "*", all cluster-scoped resource types are excluded. The default value is empty. + // Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources. // +optional // +nullable ExcludedClusterScopedResources []string `json:"excludedClusterScopedResources,omitempty"` // IncludedNamespaceScopedResources is a slice of namespace-scoped resource type names to include in the backup. + // For example, we can populate this string array with ["deployments", "configmaps"], then we will select all resources of type deployments and configmaps, // The default value is "*". + // Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources. // +optional // +nullable IncludedNamespaceScopedResources []string `json:"includedNamespaceScopedResources,omitempty"` // ExcludedNamespaceScopedResources is a slice of namespace-scoped resource type names to exclude from the backup. // If set to "*", all namespace-scoped resource types are excluded. The default value is empty. + // Cannot work with IncludedResources, ExcludedResources and IncludeClusterResources. // +optional // +nullable ExcludedNamespaceScopedResources []string `json:"excludedNamespaceScopedResources,omitempty"` @@ -97,9 +117,4 @@ type ResourceFilter struct { // +optional // +nullable OrLabelSelectors []*metav1.LabelSelector `json:"orLabelSelectors,omitempty"` - - // IncludeClusterResources specifies whether cluster-scoped resources should be included for consideration in the backup. - // +optional - // +nullable - IncludeClusterResources *bool `json:"includeClusterResources,omitempty"` } diff --git a/pkg/apis/backups/v1alpha1/migrate_type.go b/pkg/apis/backups/v1alpha1/migrate_type.go index 5e407f4d0..91c3df127 100644 --- a/pkg/apis/backups/v1alpha1/migrate_type.go +++ b/pkg/apis/backups/v1alpha1/migrate_type.go @@ -17,7 +17,6 @@ limitations under the License. package v1alpha1 import ( - velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -37,13 +36,14 @@ type Migrate struct { } type MigrateSpec struct { - // Storage details where the data should be stored. - Storage BackupStorage `json:"storage"` - // SourceCluster represents the source cluster for migration. + // The user needs to ensure that SourceCluster points to only ONE cluster. + // Because the current migration only supports migrating from one SourceCluster to one or more TargetCluster. + // +required SourceCluster *Destination `json:"sourceCluster"` // TargetCluster represents the target clusters for migration. + // +required TargetCluster *Destination `json:"targetCluster"` // Policy defines the rules for the migration. @@ -53,13 +53,22 @@ type MigrateSpec struct { type MigratePolicy struct { // ResourceFilter specifies the resources to be included in the migration. - // If not set, all resources in will be migrated. + // If not set, all resources in source cluster will be migrated. // +optional ResourceFilter *ResourceFilter `json:"resourceFilter,omitempty"` // OrderedResources specifies the backup order of resources of specific Kind. // The map key is the resource name and value is a list of object names separated by commas. // Each resource name has format "namespace/objectname". For cluster resources, simply use "objectname". + // For example, if you have a specific order for pods, such as "pod1, pod2, pod3" with all belonging to the "ns1" namespace, + // and a specific order for persistentvolumes, such as "pv4, pv8", you can use the orderedResources field in YAML format as shown below: + // + // ```yaml + // orderedResources: + // pods: "ns1/pod1, ns1/pod2, ns1/pod3" + // persistentvolumes: "pv4, pv8" + // ``` + // // +optional // +nullable OrderedResources map[string]string `json:"orderedResources,omitempty"` @@ -73,17 +82,12 @@ type MigratePolicy struct { // If nil, no objects are included. Optional. // +optional // +nullable - MigrateStatus *RestoreStatusSpec `json:"migrateStatus,omitempty"` + MigrateStatus *PreserveStatus `json:"migrateStatus,omitempty"` // PreserveNodePorts specifies whether to migrate old nodePorts from source cluster to target cluster. // +optional // +nullable PreserveNodePorts *bool `json:"preserveNodePorts,omitempty"` - - // ItemOperationTimeout specifies the time used to wait for RestoreItemAction operations. - // The default value is 1 hour. - // +optional - ItemOperationTimeout metav1.Duration `json:"itemOperationTimeout,omitempty"` } type MigrateStatus struct { @@ -96,8 +100,17 @@ type MigrateStatus struct { Phase string `json:"phase,omitempty"` // SourceClusterStatus provides a detailed status for backup in SourceCluster. - SourceClusterStatus *velerov1.BackupStatus `json:"sourceClusterStatus,omitempty"` + SourceClusterStatus *BackupDetails `json:"sourceClusterStatus,omitempty"` // TargetClusterStatus provides a detailed status for each restore in each TargetCluster. - TargetClusterStatus []*velerov1.RestoreStatus `json:"targetClusterStatus,omitempty"` + TargetClusterStatus []*RestoreDetails `json:"targetClusterStatus,omitempty"` +} + +// MigrateList contains a list of Migrate. +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type MigrateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Migrate `json:"items"` } diff --git a/pkg/apis/backups/v1alpha1/restore_type.go b/pkg/apis/backups/v1alpha1/restore_type.go index 8037c637e..f42f2be1c 100644 --- a/pkg/apis/backups/v1alpha1/restore_type.go +++ b/pkg/apis/backups/v1alpha1/restore_type.go @@ -38,27 +38,21 @@ type Restore struct { type RestoreSpec struct { // BackupName specifies the backup on which this restore operation is based. + // +required BackupName string `json:"backupName"` - // Policies defines the customization rules for the restore. - // If null, the backup will be fully restored using default settings. + // Destination indicates the clusters where restore should be performed. + // if not set, all the clusters from Backup.spec.destination will perform restore. // +optional - Policies []*RestoreSyncPolicy `json:"policies,omitempty"` -} - -type RestoreSyncPolicy struct { - // Name is the unique identifier for this restore policy. It should match the name in the backup policy. - // to ensure the restore policy corresponds to the correct backup policy. - // If a name provided by the user doesn't match any backup policy, the restore operation will fail - // and return a clear error message. - Name string `json:"name"` + Destination *Destination `json:"destination,omitempty"` - // Policy indicates the rules and filters for the restore. + // Policy defines the customization rules for the restore. + // If null, the backup will be fully restored using default settings. // +optional - Policy RestorePolicy `json:"policy,omitempty"` + Policy *RestorePolicy `json:"policy,omitempty"` } -// Note: partly copied from https://github.com/vmware-tanzu/velero/pkg/apis/restore_types.go +// Note: partly copied from https://github.com/vmware-tanzu/velero/blob/v1.11.1/pkg/apis/velero/v1/restore_types.go // RestorePolicy defines the specification for a Velero restore. type RestorePolicy struct { // ResourceFilter is the filter for the resources to be restored. @@ -73,31 +67,41 @@ type RestorePolicy struct { // +optional NamespaceMapping map[string]string `json:"namespaceMapping,omitempty"` - // RestoreStatus specifies which resources we should restore the status field. - // If nil, no objects are included. + // PreserveStatus specifies which resources we should restore the status field. + // If unset, no status will be restored. // +optional // +nullable - RestoreStatus *RestoreStatusSpec `json:"restoreStatus,omitempty"` + PreserveStatus *PreserveStatus `json:"preserveStatus,omitempty"` // PreserveNodePorts specifies whether to restore old nodePorts from backup. + // If not specified, default to false. // +optional // +nullable PreserveNodePorts *bool `json:"preserveNodePorts,omitempty"` - - // ItemOperationTimeout specifies the time used to wait for RestoreItemAction operations. - // The default value is 1 hour. - // +optional - ItemOperationTimeout metav1.Duration `json:"itemOperationTimeout,omitempty"` } -type RestoreStatusSpec struct { - // IncludedResources specifies the resources to which will restore the status. - // If empty, it applies to all resources. +// PreserveStatus specifies which resources we should restore the status field. +// The logic implemented is that everything in the included list except those items in the excluded list should be included. +// '*' in the includes list means "include everything", but it is not valid in the exclude list. +type PreserveStatus struct { + // IncludedResources determines which resources will have their status restored. + // By default, if this list is empty, it means the status for ALL resources will be restored. + // For example: + // - If you want to restore the status only for deployments and services, set: + // includedResources: ["deployments", "services"] + // - If you leave it empty, the status for all resources will be restored. + // Note: If a resource is listed in both IncludedResources and ExcludedResources, the exclusion takes precedence. // +optional // +nullable IncludedResources []string `json:"includedResources,omitempty"` - // ExcludedResources specifies the resources to which will not restore the status. + // ExcludedResources lists out the resources that will NOT have their status restored. + // By default, if this list is empty, it means the status for NO resources will be excluded from restoration. + // For instance: + // - If you want to prevent restoring the status for pods and configmaps, set: + // excludedResources: ["pods", "configmaps"] + // - If you leave it empty, no resources are excluded, and all will have their status restored (unless specified otherwise in IncludedResources). + // Note: Exclusions listed here take precedence over inclusions. So, if a resource is listed in both, its status will NOT be restored. // +optional // +nullable ExcludedResources []string `json:"excludedResources,omitempty"` @@ -112,7 +116,35 @@ type RestoreStatus struct { // +optional Phase string `json:"phase,omitempty"` - // RestoreDetails provides a detailed status for each restore in each cluster. + // Details provides a detailed status for each restore in each cluster. // +optional - RestoreDetails []*velerov1.RestoreStatus `json:"restoreDetails,omitempty"` + Details []*RestoreDetails `json:"restoreDetails,omitempty"` +} + +type RestoreDetails struct { + // ClusterName is the Name of the cluster where the restore is being performed. + // +optional + ClusterName string `json:"clusterName,omitempty"` + + // ClusterKind is the kind of ClusterName recorded in Kurator. + // +optional + ClusterKind string `json:"clusterKind,omitempty"` + + // RestoreNameInCluster is the name of the restore being performed within this cluster. + // This RestoreNameInCluster is unique in Storage. + // +optional + RestoreNameInCluster string `json:"restoreNameInCluster,omitempty"` + + // RestoreStatusInCluster is the current status of the restore performed within this cluster. + // +optional + RestoreStatusInCluster *velerov1.RestoreStatus `json:"restoreStatusInCluster,omitempty"` +} + +// RestoreList contains a list of Restore. +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type RestoreList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Restore `json:"items"` } diff --git a/pkg/apis/backups/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/backups/v1alpha1/zz_generated.deepcopy.go index 20f809016..78e1028cb 100644 --- a/pkg/apis/backups/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/backups/v1alpha1/zz_generated.deepcopy.go @@ -23,6 +23,7 @@ package v1alpha1 import ( v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" v1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -56,6 +57,60 @@ func (in *Backup) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupDetails) DeepCopyInto(out *BackupDetails) { + *out = *in + if in.BackupStatusInCluster != nil { + in, out := &in.BackupStatusInCluster, &out.BackupStatusInCluster + *out = new(v1.BackupStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupDetails. +func (in *BackupDetails) DeepCopy() *BackupDetails { + if in == nil { + return nil + } + out := new(BackupDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackupList) DeepCopyInto(out *BackupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Backup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupList. +func (in *BackupList) DeepCopy() *BackupList { + if in == nil { + return nil + } + out := new(BackupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BackupPolicy) DeepCopyInto(out *BackupPolicy) { *out = *in @@ -72,7 +127,6 @@ func (in *BackupPolicy) DeepCopyInto(out *BackupPolicy) { (*out)[key] = val } } - out.ItemOperationTimeout = in.ItemOperationTimeout return } @@ -89,23 +143,12 @@ func (in *BackupPolicy) DeepCopy() *BackupPolicy { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BackupSpec) DeepCopyInto(out *BackupSpec) { *out = *in - out.Storage = in.Storage - if in.Destination != nil { - in, out := &in.Destination, &out.Destination - *out = new(Destination) + in.Destination.DeepCopyInto(&out.Destination) + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(BackupPolicy) (*in).DeepCopyInto(*out) } - if in.Policies != nil { - in, out := &in.Policies, &out.Policies - *out = make([]*BackupSyncPolicy, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(BackupSyncPolicy) - (*in).DeepCopyInto(*out) - } - } - } return } @@ -129,13 +172,13 @@ func (in *BackupStatus) DeepCopyInto(out *BackupStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.BackupDetails != nil { - in, out := &in.BackupDetails, &out.BackupDetails - *out = make([]*v1.BackupStatus, len(*in)) + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = make([]*BackupDetails, len(*in)) for i := range *in { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] - *out = new(v1.BackupStatus) + *out = new(BackupDetails) (*in).DeepCopyInto(*out) } } @@ -153,57 +196,6 @@ func (in *BackupStatus) DeepCopy() *BackupStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackupStorage) DeepCopyInto(out *BackupStorage) { - *out = *in - out.Location = in.Location - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorage. -func (in *BackupStorage) DeepCopy() *BackupStorage { - if in == nil { - return nil - } - out := new(BackupStorage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackupStorageLocation) DeepCopyInto(out *BackupStorageLocation) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageLocation. -func (in *BackupStorageLocation) DeepCopy() *BackupStorageLocation { - if in == nil { - return nil - } - out := new(BackupStorageLocation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackupSyncPolicy) DeepCopyInto(out *BackupSyncPolicy) { - *out = *in - in.Destination.DeepCopyInto(&out.Destination) - in.Policy.DeepCopyInto(&out.Policy) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupSyncPolicy. -func (in *BackupSyncPolicy) DeepCopy() *BackupSyncPolicy { - if in == nil { - return nil - } - out := new(BackupSyncPolicy) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterSelector) DeepCopyInto(out *ClusterSelector) { *out = *in @@ -230,10 +222,16 @@ func (in *ClusterSelector) DeepCopy() *ClusterSelector { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Destination) DeepCopyInto(out *Destination) { *out = *in - if in.ClusterSelector != nil { - in, out := &in.ClusterSelector, &out.ClusterSelector - *out = new(ClusterSelector) - (*in).DeepCopyInto(*out) + if in.Clusters != nil { + in, out := &in.Clusters, &out.Clusters + *out = make([]*corev1.ObjectReference, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(corev1.ObjectReference) + **out = **in + } + } } return } @@ -276,6 +274,39 @@ func (in *Migrate) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MigrateList) DeepCopyInto(out *MigrateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Migrate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MigrateList. +func (in *MigrateList) DeepCopy() *MigrateList { + if in == nil { + return nil + } + out := new(MigrateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MigrateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MigratePolicy) DeepCopyInto(out *MigratePolicy) { *out = *in @@ -300,7 +331,7 @@ func (in *MigratePolicy) DeepCopyInto(out *MigratePolicy) { } if in.MigrateStatus != nil { in, out := &in.MigrateStatus, &out.MigrateStatus - *out = new(RestoreStatusSpec) + *out = new(PreserveStatus) (*in).DeepCopyInto(*out) } if in.PreserveNodePorts != nil { @@ -308,7 +339,6 @@ func (in *MigratePolicy) DeepCopyInto(out *MigratePolicy) { *out = new(bool) **out = **in } - out.ItemOperationTimeout = in.ItemOperationTimeout return } @@ -325,7 +355,6 @@ func (in *MigratePolicy) DeepCopy() *MigratePolicy { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MigrateSpec) DeepCopyInto(out *MigrateSpec) { *out = *in - out.Storage = in.Storage if in.SourceCluster != nil { in, out := &in.SourceCluster, &out.SourceCluster *out = new(Destination) @@ -366,16 +395,16 @@ func (in *MigrateStatus) DeepCopyInto(out *MigrateStatus) { } if in.SourceClusterStatus != nil { in, out := &in.SourceClusterStatus, &out.SourceClusterStatus - *out = new(v1.BackupStatus) + *out = new(BackupDetails) (*in).DeepCopyInto(*out) } if in.TargetClusterStatus != nil { in, out := &in.TargetClusterStatus, &out.TargetClusterStatus - *out = make([]*v1.RestoreStatus, len(*in)) + *out = make([]*RestoreDetails, len(*in)) for i := range *in { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] - *out = new(v1.RestoreStatus) + *out = new(RestoreDetails) (*in).DeepCopyInto(*out) } } @@ -393,6 +422,32 @@ func (in *MigrateStatus) DeepCopy() *MigrateStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PreserveStatus) DeepCopyInto(out *PreserveStatus) { + *out = *in + if in.IncludedResources != nil { + in, out := &in.IncludedResources, &out.IncludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludedResources != nil { + in, out := &in.ExcludedResources, &out.ExcludedResources + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreserveStatus. +func (in *PreserveStatus) DeepCopy() *PreserveStatus { + if in == nil { + return nil + } + out := new(PreserveStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) { *out = *in @@ -416,6 +471,11 @@ func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.IncludeClusterResources != nil { + in, out := &in.IncludeClusterResources, &out.IncludeClusterResources + *out = new(bool) + **out = **in + } if in.IncludedClusterScopedResources != nil { in, out := &in.IncludedClusterScopedResources, &out.IncludedClusterScopedResources *out = make([]string, len(*in)) @@ -452,11 +512,6 @@ func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) { } } } - if in.IncludeClusterResources != nil { - in, out := &in.IncludeClusterResources, &out.IncludeClusterResources - *out = new(bool) - **out = **in - } return } @@ -498,6 +553,60 @@ func (in *Restore) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreDetails) DeepCopyInto(out *RestoreDetails) { + *out = *in + if in.RestoreStatusInCluster != nil { + in, out := &in.RestoreStatusInCluster, &out.RestoreStatusInCluster + *out = new(v1.RestoreStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreDetails. +func (in *RestoreDetails) DeepCopy() *RestoreDetails { + if in == nil { + return nil + } + out := new(RestoreDetails) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestoreList) DeepCopyInto(out *RestoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Restore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreList. +func (in *RestoreList) DeepCopy() *RestoreList { + if in == nil { + return nil + } + out := new(RestoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RestoreList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RestorePolicy) DeepCopyInto(out *RestorePolicy) { *out = *in @@ -513,9 +622,9 @@ func (in *RestorePolicy) DeepCopyInto(out *RestorePolicy) { (*out)[key] = val } } - if in.RestoreStatus != nil { - in, out := &in.RestoreStatus, &out.RestoreStatus - *out = new(RestoreStatusSpec) + if in.PreserveStatus != nil { + in, out := &in.PreserveStatus, &out.PreserveStatus + *out = new(PreserveStatus) (*in).DeepCopyInto(*out) } if in.PreserveNodePorts != nil { @@ -523,7 +632,6 @@ func (in *RestorePolicy) DeepCopyInto(out *RestorePolicy) { *out = new(bool) **out = **in } - out.ItemOperationTimeout = in.ItemOperationTimeout return } @@ -540,16 +648,15 @@ func (in *RestorePolicy) DeepCopy() *RestorePolicy { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RestoreSpec) DeepCopyInto(out *RestoreSpec) { *out = *in - if in.Policies != nil { - in, out := &in.Policies, &out.Policies - *out = make([]*RestoreSyncPolicy, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(RestoreSyncPolicy) - (*in).DeepCopyInto(*out) - } - } + if in.Destination != nil { + in, out := &in.Destination, &out.Destination + *out = new(Destination) + (*in).DeepCopyInto(*out) + } + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(RestorePolicy) + (*in).DeepCopyInto(*out) } return } @@ -574,13 +681,13 @@ func (in *RestoreStatus) DeepCopyInto(out *RestoreStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - if in.RestoreDetails != nil { - in, out := &in.RestoreDetails, &out.RestoreDetails - *out = make([]*v1.RestoreStatus, len(*in)) + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = make([]*RestoreDetails, len(*in)) for i := range *in { if (*in)[i] != nil { in, out := &(*in)[i], &(*out)[i] - *out = new(v1.RestoreStatus) + *out = new(RestoreDetails) (*in).DeepCopyInto(*out) } } @@ -597,46 +704,3 @@ func (in *RestoreStatus) DeepCopy() *RestoreStatus { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RestoreStatusSpec) DeepCopyInto(out *RestoreStatusSpec) { - *out = *in - if in.IncludedResources != nil { - in, out := &in.IncludedResources, &out.IncludedResources - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ExcludedResources != nil { - in, out := &in.ExcludedResources, &out.ExcludedResources - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreStatusSpec. -func (in *RestoreStatusSpec) DeepCopy() *RestoreStatusSpec { - if in == nil { - return nil - } - out := new(RestoreStatusSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RestoreSyncPolicy) DeepCopyInto(out *RestoreSyncPolicy) { - *out = *in - in.Policy.DeepCopyInto(&out.Policy) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreSyncPolicy. -func (in *RestoreSyncPolicy) DeepCopy() *RestoreSyncPolicy { - if in == nil { - return nil - } - out := new(RestoreSyncPolicy) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/backups/v1alpha1/zz_generated.register.go b/pkg/apis/backups/v1alpha1/zz_generated.register.go index 1cacb1126..893150e0c 100644 --- a/pkg/apis/backups/v1alpha1/zz_generated.register.go +++ b/pkg/apis/backups/v1alpha1/zz_generated.register.go @@ -59,8 +59,11 @@ func init() { func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Backup{}, + &BackupList{}, &Migrate{}, + &MigrateList{}, &Restore{}, + &RestoreList{}, ) // AddToGroupVersion allows the serialization of client types like ListOptions. v1.AddToGroupVersion(scheme, SchemeGroupVersion)