mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
Don't update pvc.status.capacity if pvc is already Bound
This commit is contained in:
@@ -625,14 +625,19 @@ func (ctrl *PersistentVolumeController) updateClaimStatus(claim *v1.PersistentVo
|
|||||||
dirty = true
|
dirty = true
|
||||||
}
|
}
|
||||||
|
|
||||||
volumeCap, ok := volume.Spec.Capacity[v1.ResourceStorage]
|
// Update Capacity if the claim is becoming Bound, not if it was already.
|
||||||
if !ok {
|
// A discrepancy can be intentional to mean that the PVC filesystem size
|
||||||
return nil, fmt.Errorf("PersistentVolume %q is without a storage capacity", volume.Name)
|
// doesn't match the PV block device size, so don't clobber it
|
||||||
}
|
if claim.Status.Phase != phase {
|
||||||
claimCap, ok := claim.Status.Capacity[v1.ResourceStorage]
|
volumeCap, ok := volume.Spec.Capacity[v1.ResourceStorage]
|
||||||
if !ok || volumeCap.Cmp(claimCap) != 0 {
|
if !ok {
|
||||||
claimClone.Status.Capacity = volume.Spec.Capacity
|
return nil, fmt.Errorf("PersistentVolume %q is without a storage capacity", volume.Name)
|
||||||
dirty = true
|
}
|
||||||
|
claimCap, ok := claim.Status.Capacity[v1.ResourceStorage]
|
||||||
|
if !ok || volumeCap.Cmp(claimCap) != 0 {
|
||||||
|
claimClone.Status.Capacity = volume.Spec.Capacity
|
||||||
|
dirty = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user