diff --git a/pkg/clustertree/cluster-manager/controllers/pvc/leaf_pvc_controller.go b/pkg/clustertree/cluster-manager/controllers/pvc/leaf_pvc_controller.go index eb7597af2..9224b133d 100644 --- a/pkg/clustertree/cluster-manager/controllers/pvc/leaf_pvc_controller.go +++ b/pkg/clustertree/cluster-manager/controllers/pvc/leaf_pvc_controller.go @@ -104,7 +104,7 @@ func (l *LeafPVCController) Reconcile(ctx context.Context, request reconcile.Req klog.Errorf("patch pvc error: %v", err) return reconcile.Result{}, err } - _, err = l.RootClientSet.CoreV1().PersistentVolumeClaims(rootPVC.Namespace).Patch(ctx, + updatedRootPvc, err := l.RootClientSet.CoreV1().PersistentVolumeClaims(rootPVC.Namespace).Patch(ctx, rootPVC.Name, mergetypes.MergePatchType, patch, metav1.PatchOptions{}) if err != nil { klog.Errorf("patch pvc namespace: %q, name: %q to root cluster failed, error: %v", @@ -112,6 +112,15 @@ func (l *LeafPVCController) Reconcile(ctx context.Context, request reconcile.Req return reconcile.Result{RequeueAfter: utils.DefaultRequeueTime}, nil } + updatedRootPvc.Status = pvcCopy.Status + updatedRootPvc.ResourceVersion = "0" + err = l.RootClient.Status().Update(ctx, updatedRootPvc) + if err != nil { + klog.Errorf("update pvc status namespace: %q, name: %q to root cluster failed, error: %v", + request.NamespacedName.Namespace, request.NamespacedName.Name, err) + return reconcile.Result{RequeueAfter: utils.DefaultRequeueTime}, nil + } + return reconcile.Result{}, nil } diff --git a/pkg/clustertree/cluster-manager/controllers/pvc/root_pvc_controller.go b/pkg/clustertree/cluster-manager/controllers/pvc/root_pvc_controller.go index d065f74d3..2736ed4b9 100644 --- a/pkg/clustertree/cluster-manager/controllers/pvc/root_pvc_controller.go +++ b/pkg/clustertree/cluster-manager/controllers/pvc/root_pvc_controller.go @@ -80,8 +80,6 @@ func (r *RootPVCController) Reconcile(ctx context.Context, request reconcile.Req if reflect.DeepEqual(pvcOld.Spec.Resources.Requests, pvc.Spec.Resources.Requests) { return reconcile.Result{}, nil } - pvcOld.Spec.Resources.Requests = pvc.Spec.Resources.Requests - pvc.Spec = pvcOld.Spec pvc.Annotations = pvcOld.Annotations pvc.ObjectMeta.UID = pvcOld.ObjectMeta.UID