Skip to content

Commit

Permalink
optimize pvc resizer logic (#3145) (#3147)
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <[email protected]>

Co-authored-by: DanielZhangQD <[email protected]>
  • Loading branch information
ti-srebot and DanielZhangQD authored Aug 21, 2020
1 parent b749226 commit 287386a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/manager/member/pvc_resizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ func (p *pvcResizer) patchPVCs(ns string, selector labels.Selector, storageReque
if err != nil {
return err
}
if !volumeExpansionSupported {
klog.Warningf("Storage Class %q used by PVC %s/%s does not support volume expansion, skipped", *pvc.Spec.StorageClassName, pvc.Namespace, pvc.Name)
continue
}

if currentRequest, ok := pvc.Spec.Resources.Requests[corev1.ResourceStorage]; !ok || storageRequest.Cmp(currentRequest) > 0 {
if !volumeExpansionSupported {
klog.Warningf("Storage Class %q used by PVC %s/%s does not support volume expansion, skipped", *pvc.Spec.StorageClassName, pvc.Namespace, pvc.Name)
continue
}
_, err = p.kubeCli.CoreV1().PersistentVolumeClaims(pvc.Namespace).Patch(pvc.Name, types.MergePatchType, mergePatch)
if err != nil {
return err
Expand Down

0 comments on commit 287386a

Please sign in to comment.