Commit 520eab77 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #51356 from wongma7/pv-cap-resize

Automatic merge from submit-queue (batch tested with PRs 51441, 51356, 51460) Don't update pvc.status.capacity if pvc is already Bound As discussed here https://github.com/kubernetes/community/pull/657#discussion_r128008128, in order for `pvc.status.Capacity < pv.Spec.Capcity` to be the mechanism for volume filesystem* resize, the pv controller should stop updating pvc.status.Capacity every resync period. /assign @jsafrane /sig storage ```release-note NONE ```
parents 169de991 19ebaf28
...@@ -626,6 +626,10 @@ func (ctrl *PersistentVolumeController) updateClaimStatus(claim *v1.PersistentVo ...@@ -626,6 +626,10 @@ func (ctrl *PersistentVolumeController) updateClaimStatus(claim *v1.PersistentVo
dirty = true dirty = true
} }
// Update Capacity if the claim is becoming Bound, not if it was already.
// A discrepancy can be intentional to mean that the PVC filesystem size
// doesn't match the PV block device size, so don't clobber it
if claim.Status.Phase != phase {
volumeCap, ok := volume.Spec.Capacity[v1.ResourceStorage] volumeCap, ok := volume.Spec.Capacity[v1.ResourceStorage]
if !ok { if !ok {
return nil, fmt.Errorf("PersistentVolume %q is without a storage capacity", volume.Name) return nil, fmt.Errorf("PersistentVolume %q is without a storage capacity", volume.Name)
...@@ -636,6 +640,7 @@ func (ctrl *PersistentVolumeController) updateClaimStatus(claim *v1.PersistentVo ...@@ -636,6 +640,7 @@ func (ctrl *PersistentVolumeController) updateClaimStatus(claim *v1.PersistentVo
dirty = true dirty = true
} }
} }
}
if !dirty { if !dirty {
// Nothing to do. // Nothing to do.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment