@@ -127,6 +127,9 @@ func (r *VolumeGroupReplicationReconciler) Reconcile(ctx context.Context, req ct
127127 return reconcile.Result {}, err
128128 }
129129
130+ secretName := vgrClassObj .Spec .Parameters [prefixedGroupReplicationSecretNameKey ]
131+ secretNamespace := vgrClassObj .Spec .Parameters [prefixedGroupReplicationSecretNamespaceKey ]
132+
130133 // Declare all dependent resources
131134 vgrContentName := fmt .Sprintf ("vgrcontent-%s" , instance .UID )
132135 if instance .Spec .VolumeGroupReplicationContentName != "" {
@@ -137,6 +140,11 @@ func (r *VolumeGroupReplicationReconciler) Reconcile(ctx context.Context, req ct
137140 Name : vgrContentName ,
138141 },
139142 }
143+ if secretName != "" && secretNamespace != "" {
144+ metav1 .SetMetaDataAnnotation (& vgrContentObj .ObjectMeta , prefixedGroupReplicationSecretNameKey , secretName )
145+ metav1 .SetMetaDataAnnotation (& vgrContentObj .ObjectMeta , prefixedGroupReplicationSecretNamespaceKey , secretNamespace )
146+ }
147+
140148 vrName := fmt .Sprintf ("vr-%s" , instance .UID )
141149 if instance .Spec .VolumeReplicationName != "" {
142150 vrName = instance .Spec .VolumeReplicationName
@@ -656,9 +664,7 @@ func (r *VolumeGroupReplicationReconciler) createOrUpdateVolumeGroupReplicationC
656664 return errors .New ("dependent VGRContent resource is not yet created, waiting for it to be created" )
657665 }
658666 if vgrContentObj .CreationTimestamp .IsZero () {
659- vgrContentObj .Annotations = map [string ]string {
660- volumeGroupReplicationRef : vgrRef ,
661- }
667+ metav1 .SetMetaDataAnnotation (& vgrContentObj .ObjectMeta , volumeGroupReplicationRef , vgrRef )
662668 vgrContentObj .Spec = replicationv1alpha1.VolumeGroupReplicationContentSpec {
663669 VolumeGroupReplicationRef : & corev1.ObjectReference {
664670 APIVersion : vgr .APIVersion ,
@@ -678,7 +684,7 @@ func (r *VolumeGroupReplicationReconciler) createOrUpdateVolumeGroupReplicationC
678684 }
679685
680686 if vgrContentObj .Annotations [volumeGroupReplicationRef ] != vgrRef {
681- vgrContentObj .Annotations [ volumeGroupReplicationRef ] = vgrRef
687+ metav1 . SetMetaDataAnnotation ( & vgrContentObj .ObjectMeta , volumeGroupReplicationRef , vgrRef )
682688 }
683689
684690 if vgrContentObj .Spec .VolumeGroupReplicationRef == nil {
0 commit comments