Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend DRPolicy and VRG spec with PeerClasses #1480

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions api/v1alpha1/drpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ type DRPolicySpec struct {
// DRPolicyStatus defines the observed state of DRPolicy
type DRPolicyStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
//+optional
Async AsyncSpec `json:"async,omitempty"`
//+optional
Sync SyncSpec `json:"sync,omitempty"`
}

// for RDR
type AsyncSpec struct {
//+optional
PeerClasses []PeerClass `json:"peerClasses,omitempty"`
}

// for MetroDR
type SyncSpec struct {
//+optional
PeerClasses []PeerClass `json:"peerClasses,omitempty"`
}

const (
Expand Down
19 changes: 18 additions & 1 deletion api/v1alpha1/volumereplicationgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ type VRGAsyncSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:Pattern=`^\d+[mhd]$`
SchedulingInterval string `json:"schedulingInterval"`

//+optional
PeerClasses []PeerClass `json:"peerClasses,omitempty"`
}

// VRGSyncSpec has the parameters associated with MetroDR
type VRGSyncSpec struct{}
type VRGSyncSpec struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment at the design spec to see if we need these separated. Leaving it as is for now.

//+optional
PeerClasses []PeerClass `json:"peerClasses,omitempty"`
}

// VolSyncReplicationDestinationSpec defines the configuration for the VolSync
// protected PVC to be used by the destination cluster (Secondary)
Expand All @@ -69,6 +75,17 @@ type VolSyncReplicationDestinationSpec struct {
ProtectedPVC ProtectedPVC `json:"protectedPVC,omitempty"`
}

type PeerClass struct {
//+optional
ReplicationID string `json:"replicationID,omitempty"`

//+optional
StorageID []string `json:"storageID,omitempty"`

//+optional
StorageClassName string `json:"storageClassName,omitempty"`
}

// VolSyncReplicationSourceSpec defines the configuration for the VolSync
// protected PVC to be used by the source cluster (Primary)
type VolSyncReplicationSourceSpec struct {
Expand Down
82 changes: 81 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions config/crd/bases/ramendr.openshift.io_drpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,23 @@ spec:
status:
description: DRPolicyStatus defines the observed state of DRPolicy
properties:
async:
description: for RDR
properties:
peerClasses:
items:
properties:
replicationID:
type: string
storageClassName:
type: string
storageID:
items:
type: string
type: array
type: object
type: array
type: object
conditions:
items:
description: "Condition contains details for one aspect of the current
Expand Down Expand Up @@ -244,6 +261,23 @@ spec:
- type
type: object
type: array
sync:
description: for MetroDR
properties:
peerClasses:
items:
properties:
replicationID:
type: string
storageClassName:
type: string
storageID:
items:
type: string
type: array
type: object
type: array
type: object
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ spec:
description: VRGAsyncSpec has the parameters associated
with RegionalDR
properties:
peerClasses:
items:
properties:
replicationID:
type: string
storageClassName:
type: string
storageID:
items:
type: string
type: array
type: object
type: array
replicationClassSelector:
description: |-
Label selector to identify the VolumeReplicationClass resources
Expand Down Expand Up @@ -376,6 +389,20 @@ spec:
sync:
description: VRGSyncSpec has the parameters associated with
MetroDR
properties:
peerClasses:
items:
properties:
replicationID:
type: string
storageClassName:
type: string
storageID:
items:
type: string
type: array
type: object
type: array
type: object
volSync:
description: volsync defines the configuration when using
Expand Down
27 changes: 27 additions & 0 deletions config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ spec:
async:
description: VRGAsyncSpec has the parameters associated with RegionalDR
properties:
peerClasses:
items:
properties:
replicationID:
type: string
storageClassName:
type: string
storageID:
items:
type: string
type: array
type: object
type: array
replicationClassSelector:
description: |-
Label selector to identify the VolumeReplicationClass resources
Expand Down Expand Up @@ -325,6 +338,20 @@ spec:
type: array
sync:
description: VRGSyncSpec has the parameters associated with MetroDR
properties:
peerClasses:
items:
properties:
replicationID:
type: string
storageClassName:
type: string
storageID:
items:
type: string
type: array
type: object
type: array
type: object
volSync:
description: volsync defines the configuration when using VolSync
Expand Down
5 changes: 4 additions & 1 deletion internal/controller/drplacementcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,7 @@ func (d *DRPCInstance) generateVRGSpecAsync() *rmn.VRGAsyncSpec {
ReplicationClassSelector: d.drPolicy.Spec.ReplicationClassSelector,
VolumeSnapshotClassSelector: d.drPolicy.Spec.VolumeSnapshotClassSelector,
SchedulingInterval: d.drPolicy.Spec.SchedulingInterval,
PeerClasses: d.drPolicy.Status.Async.PeerClasses,
}
}

Expand All @@ -1622,7 +1623,9 @@ func (d *DRPCInstance) generateVRGSpecAsync() *rmn.VRGAsyncSpec {

func (d *DRPCInstance) generateVRGSpecSync() *rmn.VRGSyncSpec {
if d.drType == DRTypeSync {
return &rmn.VRGSyncSpec{}
return &rmn.VRGSyncSpec{
PeerClasses: d.drPolicy.Status.Async.PeerClasses,
}
}

return nil
Expand Down
Loading