You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -155,16 +155,16 @@ reduces the PVC request size, for both CSI and in-tree plugins they are designed
155
155
156
156
We however do have a problem with quota calculation because if a previously issued expansion is successful but is not recorded(or partially recorded) in api-server and user reduces requested size of the PVC, then quota controller will assume it as actual shrinking of volume and reduce used storage size by the user(incorrectly). Since we know actual size of the volume only after performing expansion(either on node or controller), allowing quota to be reduced on PVC size reduction will allow an user to abuse the quota system.
157
157
158
-
To solve aforementioned problem - we propose that, a new field will be added to PVC, called `pvc.Status.AllocatedResources`. When user expands the PVC, and when expansion-controller starts volume expansion - it will set `pvc.Status.AllocatedResources` to user requested value in `pvc.Spec.Resources` before performing expansion and it will set `pvc.Status.AllocatedResourceStatus[storage]` to `ControllerExpansionInProgress`. The quota calculation will be updated to use `max(pvc.Spec.Resources, pvc.Status.AllocatedResources)` which will ensure that abusing quota will not be possible.
158
+
To solve aforementioned problem - we propose that, a new field will be added to PVC, called `pvc.Status.AllocatedResources`. When user expands the PVC, and when expansion-controller starts volume expansion - it will set `pvc.Status.AllocatedResources` to user requested value in `pvc.Spec.Resources` before performing expansion and it will set `pvc.Status.AllocatedResourceStatus[storage]` to `ControllerResizeInProgress`. The quota calculation will be updated to use `max(pvc.Spec.Resources, pvc.Status.AllocatedResources)` which will ensure that abusing quota will not be possible.
159
159
160
160
Resizing operation in external resize controller will always work towards full-filling size recorded in `pvc.Status.AllocatedResources` and only when previous operation has finished(i.e `pvc.Status.AllocatedResourceStatus[storage]` is nil) or when previous operation has failed with a terminal error - it will use new user requested value from `pvc.Spec.Resources`.
161
161
162
-
Kubelet on the other hand will only expand volumes for which `pvc.Status.AllocatedResourceStatus[storage]` is in `NodeExpansionPending` or `NodeExpansionInProgress` state and `pv.Spec.Cap > pvc.Status.Cap`. If a volume expansion fails in kubelet with a terminal error(which will set `NodeExpansionFailed` state) - then it must wait for resize controller in external-resizer to reconcile the state and put it back in `NodeExpansionPending`.
162
+
Kubelet on the other hand will only expand volumes for which `pvc.Status.AllocatedResourceStatus[storage]` is in `NodeResizePending` or `NodeResizeInProgress` state and `pv.Spec.Cap > pvc.Status.Cap`. If a volume expansion fails in kubelet with a terminal error(which will set `NodeResizeFailed` state) - then it must wait for resize controller in external-resizer to reconcile the state and put it back in `NodeResizePending`.
163
163
164
164
When user reduces `pvc.Spec.Resources`, expansion-controller will set `pvc.Status.AllocatedResources` to lower value only if one of the following is true:
165
165
166
-
1. If `pvc.Status.AllocatedResourceStatus[storage]` is `ControllerExpansionFailed` (indicating that previous expansion to last known `allocatedResources` failed with a final error) and previous control-plane has not succeeded.
167
-
2. If `pvc.Status.AllocatedResourceStatus[storage]` is `NodeExpansionFailed` and SP supports node-only expansion (indicating that previous expansion to last known `allocatedResources` failed on node with a final error).
166
+
1. If `pvc.Status.AllocatedResourceStatus[storage]` is `ControllerResizeFailed` (indicating that previous expansion to last known `allocatedResources` failed with a final error) and previous control-plane has not succeeded.
167
+
2. If `pvc.Status.AllocatedResourceStatus[storage]` is `NodeResizeFailed` and SP supports node-only expansion (indicating that previous expansion to last known `allocatedResources` failed on node with a final error).
168
168
3. If `pvc.Status.AllocatedResourceStatus[storage]` is `nil` or `empty` and previous `ControllerExpandVolume` has not succeeded.
169
169
170
170

@@ -183,9 +183,9 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
183
183
- User increases 10Gi PVC to 100Gi by changing - `pvc.spec.resources.requests["storage"] = "100Gi"`.
184
184
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
185
185
- Expansion controller starts expanding the volume and sets `pvc.Status.AllocatedResources` to `100Gi`.
186
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionInProgress`.
186
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeInProgress`.
187
187
- Expansion to 100Gi fails and hence `pv.Spec.Capacity` and `pvc.Status.Capacity `stays at 10Gi.
188
-
- Expansion controller sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionFailed`.
188
+
- Expansion controller sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeFailed`.
189
189
- User requests size to 20Gi.
190
190
- Expansion controler notices that previous expansion to last known `allocatedresources` failed, so it sets new `allocatedResources` to `20G`
191
191
- Expansion succeeds and `pvc.Status.Capacity` and `pv.Spec.Capacity` report new size as `20Gi`.
@@ -195,21 +195,21 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
195
195
- User increases 10Gi PVC to 100Gi by changing - `pvc.spec.resources.requests["storage"] = "100Gi"`
196
196
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
197
197
- Expansion controller starts expanding the volume and sets `pvc.Status.AllocatedResources` to `100Gi`.
198
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionInProgress`.
198
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeInProgress`.
199
199
- Since expansion operations in control-plane are NO-OP, expansion in control-plane succeeds and `pv.Spec` is set to `100G`.
200
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeExpansionPending`.
201
-
- Expansion starts on the node and kubelet sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeExpansionInProgress`.
200
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeResizePending`.
201
+
- Expansion starts on the node and kubelet sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeResizeInProgress`.
202
202
- Expansion fails on the node with a final error.
203
-
- Kubelet sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeExpansionFailed`.
204
-
- Since pvc has `pvc.Status.AllocatedResourceStatus['storage']` set to `NodeExpansionFailed` - kubelet will stop retrying node expansion.
205
-
- At this point Kubelet will wait for `pvc.Status.AllocatedResourceStatus['storage']` to be `NodeExpansionPending`.
203
+
- Kubelet sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeResizeFailed`.
204
+
- Since pvc has `pvc.Status.AllocatedResourceStatus['storage']` set to `NodeResizeFailed` - kubelet will stop retrying node expansion.
205
+
- At this point Kubelet will wait for `pvc.Status.AllocatedResourceStatus['storage']` to be `NodeResizePending`.
206
206
- User requests size to 20Gi.
207
207
- Expansion controller starts expanding the volume and sees that last expansion failed on the node and driver does not have control-plane expansion.
208
208
- Expansion controller sets `pvc.Status.AllocatedResources` to `20G`.
209
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionInProgress`.
209
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeInProgress`.
210
210
- Since expansion operations in control-plane are NO-OP, expansion in control-plane succeeds and `pv.Spec` is set to `20G`.
211
211
- Expansion succeed on the node with latest `allocatedResources` and `pvc.Status.Size` is set to `20G`.
212
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeExpansionPending`.
212
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `NodeResizePending`.
213
213
- Kubelet can now retry expansion and expansion on node succeeds.
214
214
- Kubelet sets `pvc.Status.AllocatedResourceStatus['storage']` to empty string and `pvc.Status.Capacity` to new value.
215
215
- Quota controller sees a reduction in used quota because `max(pvc.Spec.Resources, pvc.Status.AllocatedResources)` is 20Gi.
@@ -219,7 +219,7 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
219
219
- User increases 10Gi PVC to 100Gi by changing `pvc.spec.resources.requests["storage"] = "100Gi"`
220
220
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
221
221
- Expansion controller slowly starts expanding the volume and sets `pvc.Status.AllocatedResources` to `100Gi` (before expanding).
222
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionInProgress`.
222
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeInProgress`.
223
223
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10Gi until the resize is finished.
224
224
- While the storage backend is re-sizing the volume, user requests size 20Gi by changing `pvc.spec.resources.requests["storage"] = "20Gi"`
225
225
- Expansion controller notices that previous expansion to last known `allocatedresources` is still in-progress.
@@ -234,7 +234,7 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
234
234
- User expands expands the PVC to 100GB.
235
235
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `89.9GB` to used quota.
236
236
- Expansion controller starts expanding the volume and sets `pvc.Status.AllocatedResources` to `100GB` (before expanding).
237
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionInProgress`.
237
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeInProgress`.
238
238
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10.1GB until the resize is finished.
239
239
- while resize was in progress - expansion controler crashes and loses state.
240
240
- User reduces the size of PVC to 10.5GB.
@@ -248,11 +248,11 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
248
248
- User increases 10Gi PVC to 100Gi by changing `pvc.spec.resources.requests["storage"] = "100Gi"`
249
249
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
250
250
- Expansion controller slowly starts expanding the volume and sets `pvc.Status.AllocatedResources` to `100Gi` (before expanding).
251
-
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerExpansionInProgress`.
251
+
- Expansion controller also sets `pvc.Status.AllocatedResourceStatus['storage']` to `ControllerResizeInProgress`.
252
252
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10Gi until the resize is finished.
253
253
- While the storage backend is re-sizing the volume, user requests size 200Gi by changing `pvc.spec.resources.requests["storage"] = "200Gi"`
254
254
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `100Gi` to used quota.
255
-
- Since `pvc.Status.AllocatedResourceStatus['storage']` is in `ControllerExpansionInProgress` - expansion controller still chooses last `pvc.Status.AllocatedResources` as new size.
255
+
- Since `pvc.Status.AllocatedResourceStatus['storage']` is in `ControllerResizeInProgress` - expansion controller still chooses last `pvc.Status.AllocatedResources` as new size.
256
256
- User reduces size back to `20Gi`.
257
257
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and *returns*`100Gi` to used quota.
258
258
- Expansion controller notices that previous expansion to last known `allocatedresources` is still in-progress.
@@ -447,10 +447,10 @@ _This section must be completed when targeting beta graduation to a release._
447
447
***What are other known failure modes?**
448
448
For each of them fill in the following information by copying the below template:
449
449
- No recovery is possible if volume has been expanded on control-plane and only failing on node.
450
-
- Detection: Expansion is stuck with `ResizeStatus` - `NodeExpansionPending` or `NodeExpansionFailed`.
450
+
- Detection: Expansion is stuck with `ResizeStatus` - `NodeResizePending` or `NodeResizeFailed`.
451
451
- Mitigations: This should not affect any of existing PVCs but this was already broken in some sense and if volume has been
452
452
expanded in control-plane then we can't allow users to shrink their PVCs because that would violate the quota.
453
-
- Diagnostics: Expansion is stuck with `ResizeStatus` - `NodeExpansionPending` or `NodeExpansionFailed`.
453
+
- Diagnostics: Expansion is stuck with `ResizeStatus` - `NodeResizePending` or `NodeResizeFailed`.
454
454
- Testing: There are some unit tests for this failure mode.
455
455
456
456
***What steps should be taken if SLOs are not being met to determine the problem?**
0 commit comments