Skip to content

Commit 0994c20

Browse files
Madhu-1mergify[bot]
authored andcommitted
replication: add driver name to the VGRC
store the driver name in the VGRC annotation for identification, With this we dont need to pull the complete object to get the driver. checking the metadata is enough Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
1 parent bd0e7a8 commit 0994c20

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/controller/replication.storage/volumegroupreplication_controller.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ const (
5353
volumeGroupReplicationContent = "VolumeGroupReplicationContent"
5454
volumeGroupReplicationRef = "replication.storage.openshift.io/volumegroupref"
5555
pvcSelector = "pvcSelector"
56+
// This annotation is added to a VGRC that has been dynamically provisioned by
57+
// csi-addons. Its value is name of driver that created the volume group.
58+
annDynamicallyProvisioned = "replication.storage.openshift.io/provisioned-by"
5659
)
5760

5861
// VolumeGroupReplicationReconciler reconciles a VolumeGroupReplication object
@@ -666,7 +669,7 @@ func (r *VolumeGroupReplicationReconciler) cleanupGroupPVC(vgr *replicationv1alp
666669
}
667670

668671
func (r *VolumeGroupReplicationReconciler) createOrUpdateVolumeGroupReplicationContentCR(vgr *replicationv1alpha1.VolumeGroupReplication,
669-
vgrContentObj *replicationv1alpha1.VolumeGroupReplicationContent, vgrClass string, pvHandlesList []string) error {
672+
vgrContentObj *replicationv1alpha1.VolumeGroupReplicationContent, driver string, pvHandlesList []string) error {
670673
vgrRef := fmt.Sprintf("%s/%s", vgr.Namespace, vgr.Name)
671674
_, err := controllerutil.CreateOrUpdate(r.ctx, r.Client, vgrContentObj, func() error {
672675
if vgr.Spec.VolumeGroupReplicationContentName != "" && vgrContentObj.CreationTimestamp.IsZero() {
@@ -682,7 +685,7 @@ func (r *VolumeGroupReplicationReconciler) createOrUpdateVolumeGroupReplicationC
682685
Namespace: vgr.Namespace,
683686
UID: vgr.UID,
684687
},
685-
Provisioner: vgrClass,
688+
Provisioner: driver,
686689
VolumeGroupReplicationClassName: vgr.Spec.VolumeGroupReplicationClassName,
687690
Source: replicationv1alpha1.VolumeGroupReplicationContentSource{
688691
VolumeHandles: pvHandlesList,
@@ -695,6 +698,7 @@ func (r *VolumeGroupReplicationReconciler) createOrUpdateVolumeGroupReplicationC
695698
if vgrContentObj.Annotations[volumeGroupReplicationRef] != vgrRef {
696699
metav1.SetMetaDataAnnotation(&vgrContentObj.ObjectMeta, volumeGroupReplicationRef, vgrRef)
697700
}
701+
metav1.SetMetaDataAnnotation(&vgrContentObj.ObjectMeta, annDynamicallyProvisioned, driver)
698702

699703
if vgrContentObj.Spec.VolumeGroupReplicationRef == nil {
700704
vgrContentObj.Spec.VolumeGroupReplicationRef = &corev1.ObjectReference{

0 commit comments

Comments
 (0)