Skip to content

Commit 940ebd1

Browse files
committed
Added a case that describes rapid expansion and shrink
1 parent 568d8fb commit 940ebd1

File tree

1 file changed

+20
-1
lines changed
  • keps/sig-storage/1790-recover-resize-failure

1 file changed

+20
-1
lines changed

keps/sig-storage/1790-recover-resize-failure/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Case 2 (node only expandable volume):](#case-2-node-only-expandable-volume)
1717
- [Case 3 (Malicious user)](#case-3-malicious-user)
1818
- [Case 4(Malicious User and rounding to GB/GiB bounaries)](#case-4malicious-user-and-rounding-to-gbgib-bounaries)
19+
- [Case 5(Rapid successive expansion and shrink)](#case-5rapid-successive-expansion-and-shrink)
1920
- [Risks and Mitigations](#risks-and-mitigations)
2021
- [Graduation Criteria](#graduation-criteria)
2122
- [Test Plan](#test-plan)
@@ -123,7 +124,7 @@ When user reduces `pvc.Spec.Resources`, expansion-controller will set `pvc.Statu
123124

124125
1. If `pvc.Status.ResizeStatus` is `ControllerExpansionFailed` (indicating that previous expansion to last known `allocatedResources` failed with a final error) and previous control-plane has not succeeded.
125126
2. If `pvc.Status.ResizeStatus` is `NodeExpansionFailed` and SP supports node-only expansion (indicating that previous expansion to last known `allocatedResources` failed on node with a final error).
126-
3. If `pvc.Status.ResizeStatus` is `nil` or `empty` and previous `ControllerExpandVolume** has not succeeded.
127+
3. If `pvc.Status.ResizeStatus` is `nil` or `empty` and previous `ControllerExpandVolume` has not succeeded.
127128

128129
![Determining new size](./get_new_size.png)
129130

@@ -202,6 +203,24 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
202203
- Although `pvc.Spec.Resources` reports size as `10.5GB`, expansion to `10.5GB` is never attempted.
203204
- Quota controller sees no change in storage usage by the PVC because `pvc.Status.AllocatedResources` is 100Gi.
204205

206+
##### Case 5(Rapid successive expansion and shrink)
207+
- User increases 10Gi PVC to 100Gi by changing `pvc.spec.resources.requests["storage"] = "100Gi"`
208+
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
209+
- Expansion controller slowly starts expanding the volume and sets `pvc.Status.AllocatedResources` to `100Gi` (before expanding).
210+
- Expansion controller also sets `pvc.Status.ResizeStatus` to `ControllerExpansionInProgress`.
211+
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10Gi until the resize is finished.
212+
- While the storage backend is re-sizing the volume, user requests size 200Gi by changing `pvc.spec.resources.requests["storage"] = "200Gi"`
213+
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `100Gi` to used quota.
214+
- Since `pvc.Status.ResizeStatus` is in `ControllerExpansionInProgress` - expansion controller still chooses last `pvc.Status.AllocatedResources` as new size.
215+
- User reduces size back to `20Gi`.
216+
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and *returns* `100Gi` to used quota.
217+
- Expansion controller notices that previous expansion to last known `allocatedresources` is still in-progress.
218+
- Expansion controller keeps expanding the volume to `allocatedResources`.
219+
- Expansion to `100G` succeeds and `pv.Spec.Capacity` and `pvc.Status.Capacity` report new size as `100G`.
220+
- Although `pvc.Spec.Resources` reports size as `20G`, expansion to `20G` is never attempted.
221+
- Quota controller sees no change in storage usage by the PVC because `pvc.Status.AllocatedResources` is 100Gi.
222+
223+
205224
### Risks and Mitigations
206225

207226
- Once expansion is initiated, the lowering of requested size is only allowed upto a value *greater* than `pvc.Status`. It is not possible to entirely go back to previously requested size. This should not be a problem however in-practice because user can retry expansion with slightly higher value than `pvc.Status` and still recover from previously failing expansion request.

0 commit comments

Comments
 (0)