Skip to content

Commit

Permalink
Merge pull request kosmos-io#675 from zhouhaoA1/fix_pvc_0.4.0
Browse files Browse the repository at this point in the history
fix leaf pvc storage update
  • Loading branch information
duanmengkk authored Aug 11, 2024
2 parents 8f4a7ae + d90b4cb commit 0b5b75e
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 0b5b75e

Please sign in to comment.