diff --git a/api/v1alpha1/drpolicy_types.go b/api/v1alpha1/drpolicy_types.go index b53a06818..5eee53189 100644 --- a/api/v1alpha1/drpolicy_types.go +++ b/api/v1alpha1/drpolicy_types.go @@ -54,6 +54,49 @@ type DRPolicySpec struct { // DRPolicyStatus defines the observed state of DRPolicy type DRPolicyStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` + + // DRPolicyStatus.Async contains the status of observed + // async replication details between the clusters in the policy + //+optional + Async Async `json:"async,omitempty"` + + // DRPolicyStatus.Sync contains the status of observed + // sync replication details between the clusters in the policy + //+optional + Sync Sync `json:"sync,omitempty"` +} + +// for RDR +type Async struct { + // PeerClasses is a list of common StorageClasses across the clusters in a policy + // that have related async relationships. (one per pair of peers in the policy) + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` +} + +// for MetroDR +type Sync struct { + // PeerClasses is a list of common StorageClasses across the clusters in a policy + // that have related sync relationships. (one per pair of peers in the policy) + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` +} + +type PeerClass struct { + // ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + // VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + //+optional + ReplicationID string `json:"replicationID,omitempty"` + + // StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + // StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + // and distict if storage instances are different. + //+optional + StorageID []string `json:"storageID,omitempty"` + + // StorageClassName is the name of a StorageClass that is available across the peers + //+optional + StorageClassName string `json:"storageClassName,omitempty"` } const ( diff --git a/api/v1alpha1/volumereplicationgroup_types.go b/api/v1alpha1/volumereplicationgroup_types.go index 964362689..868c2bd20 100644 --- a/api/v1alpha1/volumereplicationgroup_types.go +++ b/api/v1alpha1/volumereplicationgroup_types.go @@ -62,10 +62,22 @@ type VRGAsyncSpec struct { // +kubebuilder:validation:Required // +kubebuilder:validation:Pattern=`^\d+[mhd]$` SchedulingInterval string `json:"schedulingInterval"` + + // PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + // sync relationships. This is ONLY modified post creation, if the workload that is protected + // creates a PVC using a newer StorageClass that is determined to be common across the peers. + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` } -// VRGSyncSpec has the parameters associated with MetroDR -type VRGSyncSpec struct{} +// VRGSyncSpec has the parameters associated with VE +type VRGSyncSpec struct { + // PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + // async relationships. This is ONLY modified post creation, if the workload that is protected + // creates a PVC using a newer StorageClass that is determined to be common across the peers. + //+optional + PeerClasses []PeerClass `json:"peerClasses,omitempty"` +} // VolSyncReplicationDestinationSpec defines the configuration for the VolSync // protected PVC to be used by the destination cluster (Secondary) diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 59059ff6e..c39af6791 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -14,6 +14,28 @@ import ( configv1alpha1 "k8s.io/component-base/config/v1alpha1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Async) DeepCopyInto(out *Async) { + *out = *in + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Async. +func (in *Async) DeepCopy() *Async { + if in == nil { + return nil + } + out := new(Async) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterMaintenanceMode) DeepCopyInto(out *ClusterMaintenanceMode) { *out = *in @@ -506,6 +528,8 @@ func (in *DRPolicyStatus) DeepCopyInto(out *DRPolicyStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + in.Async.DeepCopyInto(&out.Async) + in.Sync.DeepCopyInto(&out.Sync) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DRPolicyStatus. @@ -722,6 +746,26 @@ func (in *MaintenanceModeStatus) DeepCopy() *MaintenanceModeStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PeerClass) DeepCopyInto(out *PeerClass) { + *out = *in + if in.StorageID != nil { + in, out := &in.StorageID, &out.StorageID + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerClass. +func (in *PeerClass) DeepCopy() *PeerClass { + if in == nil { + return nil + } + out := new(PeerClass) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PlacementDecision) DeepCopyInto(out *PlacementDecision) { *out = *in @@ -1302,12 +1346,41 @@ func (in *StorageIdentifiers) DeepCopy() *StorageIdentifiers { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Sync) DeepCopyInto(out *Sync) { + *out = *in + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sync. +func (in *Sync) DeepCopy() *Sync { + if in == nil { + return nil + } + out := new(Sync) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VRGAsyncSpec) DeepCopyInto(out *VRGAsyncSpec) { *out = *in in.ReplicationClassSelector.DeepCopyInto(&out.ReplicationClassSelector) in.VolumeSnapshotClassSelector.DeepCopyInto(&out.VolumeSnapshotClassSelector) in.VolumeGroupSnapshotClassSelector.DeepCopyInto(&out.VolumeGroupSnapshotClassSelector) + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VRGAsyncSpec. @@ -1366,6 +1439,13 @@ func (in *VRGResourceMeta) DeepCopy() *VRGResourceMeta { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VRGSyncSpec) DeepCopyInto(out *VRGSyncSpec) { *out = *in + if in.PeerClasses != nil { + in, out := &in.PeerClasses, &out.PeerClasses + *out = make([]PeerClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VRGSyncSpec. @@ -1508,7 +1588,7 @@ func (in *VolumeReplicationGroupSpec) DeepCopyInto(out *VolumeReplicationGroupSp if in.Sync != nil { in, out := &in.Sync, &out.Sync *out = new(VRGSyncSpec) - **out = **in + (*in).DeepCopyInto(*out) } in.VolSync.DeepCopyInto(&out.VolSync) if in.KubeObjectProtection != nil { diff --git a/config/crd/bases/ramendr.openshift.io_drpolicies.yaml b/config/crd/bases/ramendr.openshift.io_drpolicies.yaml index cb51d2c99..e6891873a 100644 --- a/config/crd/bases/ramendr.openshift.io_drpolicies.yaml +++ b/config/crd/bases/ramendr.openshift.io_drpolicies.yaml @@ -222,6 +222,37 @@ spec: status: description: DRPolicyStatus defines the observed state of DRPolicy properties: + async: + description: |- + DRPolicyStatus.Async contains the status of observed + async replication details between the clusters in the policy + properties: + peerClasses: + description: |- + PeerClasses is a list of common StorageClasses across the clusters in a policy + that have related async relationships. (one per pair of peers in the policy) + items: + properties: + replicationID: + description: |- + ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + type: string + storageClassName: + description: StorageClassName is the name of a StorageClass + that is available across the peers + type: string + storageID: + description: |- + StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + and distict if storage instances are different. + items: + type: string + type: array + type: object + type: array + type: object conditions: items: description: "Condition contains details for one aspect of the current @@ -291,6 +322,37 @@ spec: - type type: object type: array + sync: + description: |- + DRPolicyStatus.Sync contains the status of observed + sync replication details between the clusters in the policy + properties: + peerClasses: + description: |- + PeerClasses is a list of common StorageClasses across the clusters in a policy + that have related sync relationships. (one per pair of peers in the policy) + items: + properties: + replicationID: + description: |- + ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + type: string + storageClassName: + description: StorageClassName is the name of a StorageClass + that is available across the peers + type: string + storageID: + description: |- + StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + and distict if storage instances are different. + items: + type: string + type: array + type: object + type: array + type: object type: object type: object served: true diff --git a/config/crd/bases/ramendr.openshift.io_protectedvolumereplicationgrouplists.yaml b/config/crd/bases/ramendr.openshift.io_protectedvolumereplicationgrouplists.yaml index 727101a16..806def40b 100644 --- a/config/crd/bases/ramendr.openshift.io_protectedvolumereplicationgrouplists.yaml +++ b/config/crd/bases/ramendr.openshift.io_protectedvolumereplicationgrouplists.yaml @@ -120,6 +120,32 @@ spec: description: VRGAsyncSpec has the parameters associated with RegionalDR properties: + peerClasses: + description: |- + PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + sync relationships. This is ONLY modified post creation, if the workload that is protected + creates a PVC using a newer StorageClass that is determined to be common across the peers. + items: + properties: + replicationID: + description: |- + ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + type: string + storageClassName: + description: StorageClassName is the name of a + StorageClass that is available across the peers + type: string + storageID: + description: |- + StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + and distict if storage instances are different. + items: + type: string + type: array + type: object + type: array replicationClassSelector: description: |- Label selector to identify the VolumeReplicationClass resources @@ -422,7 +448,34 @@ spec: type: array sync: description: VRGSyncSpec has the parameters associated with - MetroDR + VE + properties: + peerClasses: + description: |- + PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + async relationships. This is ONLY modified post creation, if the workload that is protected + creates a PVC using a newer StorageClass that is determined to be common across the peers. + items: + properties: + replicationID: + description: |- + ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + type: string + storageClassName: + description: StorageClassName is the name of a + StorageClass that is available across the peers + type: string + storageID: + description: |- + StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + and distict if storage instances are different. + items: + type: string + type: array + type: object + type: array type: object volSync: description: volsync defines the configuration when using diff --git a/config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml b/config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml index 0a8fab00e..c56788a88 100644 --- a/config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml +++ b/config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml @@ -70,6 +70,32 @@ spec: async: description: VRGAsyncSpec has the parameters associated with RegionalDR properties: + peerClasses: + description: |- + PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + sync relationships. This is ONLY modified post creation, if the workload that is protected + creates a PVC using a newer StorageClass that is determined to be common across the peers. + items: + properties: + replicationID: + description: |- + ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + type: string + storageClassName: + description: StorageClassName is the name of a StorageClass + that is available across the peers + type: string + storageID: + description: |- + StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + and distict if storage instances are different. + items: + type: string + type: array + type: object + type: array replicationClassSelector: description: |- Label selector to identify the VolumeReplicationClass resources @@ -371,7 +397,34 @@ spec: type: string type: array sync: - description: VRGSyncSpec has the parameters associated with MetroDR + description: VRGSyncSpec has the parameters associated with VE + properties: + peerClasses: + description: |- + PeerClasses is a list of common StorageClasses across the clusters in a policy that have related + async relationships. This is ONLY modified post creation, if the workload that is protected + creates a PVC using a newer StorageClass that is determined to be common across the peers. + items: + properties: + replicationID: + description: |- + ReplicationID is the common value for the label "ramendr.openshift.io/replicationID" on the corresponding + VolumeReplicationClass or VolumeGroupReplicationClass on each peer for the matched StorageClassName. + type: string + storageClassName: + description: StorageClassName is the name of a StorageClass + that is available across the peers + type: string + storageID: + description: |- + StorageID is the collection of values for the label "ramendr.openshift.io/storageID" on the corresponding + StorageClassName across the peers. It is singleton if the storage instance is shared across the peers, + and distict if storage instances are different. + items: + type: string + type: array + type: object + type: array type: object volSync: description: volsync defines the configuration when using VolSync