Skip to content

Commit 91f9a7a

Browse files
committed
Add a message to show DataSourceRef
1 parent cae0b46 commit 91f9a7a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/syncer/cnsoperator/controller/cnsregistervolume/cnsregistervolume_controller.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,24 @@ func (r *ReconcileCnsRegisterVolume) Reconcile(ctx context.Context,
597597
}
598598
return reconcile.Result{RequeueAfter: timeout}, nil
599599
}
600+
601+
// Check DataSourceRef if it exists
602+
if pvc.Spec.DataSourceRef != nil {
603+
// Print out the DataSourceRef if it exists and is not a VolumeSnapshot
604+
if !(pvc.Spec.DataSourceRef.Kind == "VolumeSnapshot" && (pvc.Spec.DataSourceRef.APIGroup != nil &&
605+
*pvc.Spec.DataSourceRef.APIGroup == "snapshot.storage.k8s.io")) {
606+
log.Infof("PVC %s in namespace %s has DataSourceRef with apiGroup: %s, kind: %s, name: %s",
607+
pvc.Name, pvc.Namespace,
608+
func() string {
609+
if pvc.Spec.DataSourceRef.APIGroup != nil {
610+
return *pvc.Spec.DataSourceRef.APIGroup
611+
}
612+
return ""
613+
}(),
614+
pvc.Spec.DataSourceRef.Kind,
615+
pvc.Spec.DataSourceRef.Name)
616+
}
617+
}
600618
} else {
601619
log.Errorf("Failed to create PVC with spec: %+v. Error: %+v", pvcSpec, err)
602620
setInstanceError(ctx, r, instance,

0 commit comments

Comments
 (0)