Don't update pvc.status.capacity if pvc is already Bound
This commit is contained in:
		| @@ -625,6 +625,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) | ||||||
| @@ -635,6 +639,7 @@ func (ctrl *PersistentVolumeController) updateClaimStatus(claim *v1.PersistentVo | |||||||
| 				dirty = true | 				dirty = true | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if !dirty { | 	if !dirty { | ||||||
| 		// Nothing to do. | 		// Nothing to do. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Wong
					Matthew Wong