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

List protected consistency groups in VRG and DRPC #1647

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ELENAGER
Copy link
Member

@ELENAGER ELENAGER commented Nov 11, 2024

When protecting standalone PVCs, we are displaying flat list of protected PVCs in both VRG and DRPC. When working with consistency groups, we want to display the list of protected consistency groups each one with it's protected PVCs for better understanding the hierarchy
Sample of DRPC showing protected consistency group with list of PVCs:

  resourceMeta:
    generation: 1
    kind: VolumeReplicationGroup
    name: deployment-rbd-drpc
    namespace: deployment-rbd
    protectedcgs:
    - name: rook-ceph-dr1-1deployment-rbd-drpc
      protectedpvcs:
      - extra-pvc
      - busybox-pvc
    resourceVersion: "350102"

Sample of VRG, showing protected consistency group with list of PVCs:

protectedCGs:
- accessModes:
  - ReadWriteOnce
  conditions:
  - lastTransitionTime: "2024-11-11T12:04:22Z"
    message: PVC in the VolumeReplicationGroup is ready for use
    observedGeneration: 1
    reason: Ready
    status: "True"
    type: DataReady
  - lastTransitionTime: "2024-11-11T12:04:22Z"
    message: PV cluster data already protected for PVC extra-pvc
    observedGeneration: 1
    reason: Uploaded
    status: "True"
    type: ClusterDataProtected
  - lastTransitionTime: "2024-11-11T12:04:19Z"
    message: PVC in the VolumeReplicationGroup is ready for use
    observedGeneration: 1
    reason: Replicating
    status: "False"
    type: DataProtected
  csiProvisioner: rook-ceph.rbd.csi.ceph.com
  labels:
    app: deployment-rbd
    app.kubernetes.io/part-of: deployment-rbd
    appname: busybox
    ramendr.openshift.io/consistency-group: rook-ceph-dr1-1
    ramendr.openshift.io/owner-name: deployment-rbd-drpc
    ramendr.openshift.io/owner-namespace-name: deployment-rbd
  lastSyncBytes: 81920
  lastSyncDuration: 0s
  lastSyncTime: "2024-11-11T12:14:00Z"
  name: rook-ceph-dr1-1deployment-rbd-drpc
  namespace: deployment-rbd
  protectedPVCs:
  - extra-pvc
  - busybox-pvc
  replicationID:
    id: ""
  resources:
    requests:
      storage: 1Gi
  storageClassName: rook-ceph-block
  storageID:
    id: rook-ceph-dr1-1
state: Primary

@@ -167,6 +167,16 @@ type PlacementDecision struct {
ClusterNamespace string `json:"clusterNamespace,omitempty"`
}

// ProtectedPVCsList defines a group of ProtectedPVCs
type ProtectedPVCsList struct {
Copy link
Member

Choose a reason for hiding this comment

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

Given that you are using List in the name, then drop the s, It becomes type ProtectedPVCList struct

type ProtectedPVCsList struct {
// Name of the VolRep/PVC resource
//+optional
Name string `json:"name,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

The comment is confusing. Where are you going to get this name from? I think you mean some name for either VolRep or VolSync, but not both.

//+optional
Name string `json:"name,omitempty"`

// All the protected pvcs
Copy link
Member

Choose a reason for hiding this comment

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

All the protected PVCs for a VolRep or VolSync but not both right?

ProtectedPVC `json:",inline"`

// List the protected pvcs names
PVCs []string `json:"protectedPVCs,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

So this looks like:

ProtectedPVC:
  Name: pvcName1
  Namespace: ...
  ...
  PVCs:
    pvcName1
    pvcName2

I think it is too complicated. I think what we want is something like:

type ProtectedCG struct {
    Name: <any name that represents one group>
   ProtectedPVCs []ProtectedPVC
}

That will translate for one ProtectedCG to something like:

ProtectedCG:
    name: CG1

    protectedPVCs:
    - accessModes:
       - ReadWriteOnce
       annotations:
       ...
       name: busybox-cg1-pvc1
       ...
   - accessModes:
         - ReadWriteOnce
      annotations:
          ...
      name: busybox-cg1-pvc2
         ....
         .....

Copy link
Member Author

@ELENAGER ELENAGER Nov 21, 2024

Choose a reason for hiding this comment

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

@BenamarMk , as I understood from Madhu, when we are speaking of consistency group, there is no info on PVC level, only CG has conditions, etc. So, I decided to show all the conditions on CG level and then to append list of protected PVC names. I attached the sample in the description of the PR,

So, to be simple - protected CG looks exactly like protected PVC, but with list of PVC names

@raghavendra-talur
Copy link
Member

@ELENAGER This PR only has the api changes, it would be better to see the code that adds this information to the status in the same PR.

Also, I am still wondering if a consistency group is a hierarchy level or just an attribute on the protectedPVC. What are you thoughts @BenamarMk @ShyamsundarR

@@ -185,6 +195,10 @@ type VRGResourceMeta struct {
//+optional
ProtectedPVCs []string `json:"protectedpvcs,omitempty"`

// List of CGs that are protected by the VRG resource
Copy link
Member

Choose a reason for hiding this comment

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

Instead of adding a synthetic name for each group, can we simplify this to something like so:

  status:
    resourceConditions:
      resourceMeta:
        generation: 1
        kind: Test
        name: test
        namespace: test
        protectedpvcs:
        - mongo-1
        - mongo-2
        - logger
        - data
        pvcgroups:
        - grouped:
          - mongo-1
          - mongo-2
        - grouped:
          - logger
          - data

Generated using this sample change to the types file:

index b4cb8d04..7164b143 100644
--- a/api/v1alpha1/drplacementcontrol_types.go
+++ b/api/v1alpha1/drplacementcontrol_types.go
@@ -167,6 +167,10 @@ type PlacementDecision struct {
        ClusterNamespace string `json:"clusterNamespace,omitempty"`
 }
 
+type Groups struct {
+       Grouped []string `json:"grouped,omitempty"`
+}
+
 // VRGResourceMeta represents the VRG resource.
 type VRGResourceMeta struct {
        // Kind is the kind of the Kubernetes resource.
@@ -184,6 +188,7 @@ type VRGResourceMeta struct {
        // List of PVCs that are protected by the VRG resource
        //+optional
        ProtectedPVCs []string `json:"protectedpvcs,omitempty"`
+       PVCGroups     []Groups `json:"pvcgroups,omitempty"`
 
        // ResourceVersion is a value used to identify the version of the
        // VRG resource object

ProtectedPVCs []ProtectedPVC `json:"protectedPVCs,omitempty"`
ProtectedCGs []ProtectedCG `json:"protectedCGs,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Similarly here we can just add a patch like so:

index 0332a027..d2362589 100644
--- a/api/v1alpha1/volumereplicationgroup_types.go
+++ b/api/v1alpha1/volumereplicationgroup_types.go
@@ -327,6 +327,7 @@ type VolumeReplicationGroupStatus struct {
 
        // All the protected pvcs
        ProtectedPVCs []ProtectedPVC `json:"protectedPVCs,omitempty"`
+       PVCGroups     []Groups       `json:"pvcgroups,omitempty"`
 
        // Conditions are the list of VRG's summary conditions and their status.
        Conditions []metav1.Condition `json:"conditions,omitempty"`

Let ProtectedPVCs and their details remain as is, no need to disturb them.

We also will avoid needing to synthetically generate a name per group.

Copy link
Member Author

Choose a reason for hiding this comment

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

According to Madhu, in case of groups we have no information on PVC level, only group have conditions. If so, why we need the whole ProtectedPVC list? It was my first thought, but then I decided, that ProtectedCG can "become" ProtectedPVC with list of pvc names in addition

@ShyamsundarR
Copy link
Member

Also, I am still wondering if a consistency group is a hierarchy level or just an attribute on the protectedPVC. What are you thoughts @BenamarMk @ShyamsundarR

There is (at present) no hierarchy for the groups. PVCs are protected as a group, thereby having some additional properties (like consistency across these PVCs data). The need is to reflect back to the user, which PVCs were grouped together during protection, in case it is seen as an inadequate grouping the user can take subsequent action to group them as desired.

When protecting standalone PVCs, we are displaying list of protected PVCs in VRG and DRPC. When working with consistency groups, we want to display the list of protected PVCs per consistency groups for better understanding, what was protected

Signed-off-by: Elena Gershkovich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants