Skip to content

Commit

Permalink
fix leaf pvc storage update
Browse files Browse the repository at this point in the history
Signed-off-by: zhouhao_yewu <zhouhao_yewu@cmss.chinamobile.com>
  • Loading branch information
zhouhaoA1 committed Aug 11, 2024
1 parent 8f4a7ae commit d90b4cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,23 @@ 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",
request.NamespacedName.Namespace, request.NamespacedName.Name, err)
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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d90b4cb

Please sign in to comment.