Skip to content

Commit

Permalink
Merge pull request #680 from zhouhaoA1/main
Browse files Browse the repository at this point in the history
Cherry-Pick: fix leaf pvc storage update
  • Loading branch information
duanmengkk authored Aug 13, 2024
2 parents db8483e + 997206d commit 1057f30
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 @@ -88,8 +88,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 1057f30

Please sign in to comment.