Skip to content

Commit 2e6ca22

Browse files
committed
Rename expansion related conditions to resizing related
1 parent b951b91 commit 2e6ca22

File tree

1 file changed

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

1 file changed

+28
-28
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ After some discussion with sig-storage folks and to accommodate changes coming f
115115
So basically new API will look like:
116116

117117
```go
118-
type ClaimResourceResizeStatus string
118+
type ClaimResourceStatus string
119119

120120
const (
121-
PersistentVolumeClaimControllerExpansionInProgress ClaimResourceResizeStatus = "ControllerExpansionInProgress"
122-
PersistentVolumeClaimControllerExpansionFailed ClaimResourceResizeStatus = "ControllerExpansionFailed"
121+
PersistentVolumeClaimControllerResizeProgress ClaimResourceStatus = "ControllerResizeInProgress"
122+
PersistentVolumeClaimControllerResizeFailed ClaimResourceStatus = "ControllerResizeFailed"
123123

124-
PersistentVolumeClaimNodeExpansionPending ClaimResourceResizeStatus = "NodeExpansionPending"
125-
PersistentVolumeClaimNodeExpansionInProgress ClaimResourceResizeStatus = "NodeExpansionInProgress"
126-
PersistentVolumeClaimNodeExpansionFailed ClaimResourceResizeStatus = "NodeExpansionFailed"
124+
PersistentVolumeClaimNodeResizePending ClaimResourceStatus = "NodeResizePending"
125+
PersistentVolumeClaimNodeResizeInProgress ClaimResourceStatus = "NodeResizeInProgress"
126+
PersistentVolumeClaimNodeResizeFailed ClaimResourceStatus = "NodeResizeFailed"
127127
)
128128

129129
// PersistentVolumeClaimStatus represents the status of PV claim
@@ -142,8 +142,8 @@ type PersistentVolumeClaimStatus struct {
142142
// AllocatedResourceStatus stores a map of resource that is being expanded
143143
// and possible status that the resource exists in.
144144
// Some examples may be:
145-
// pvc.status.allocatedResourceStatus["storage"] = "ControllerExpansionInProgress"
146-
AllocatedResourceStatus map[ResourceName]ClaimResourceResizeStatus
145+
// pvc.status.allocatedResourceStatus["storage"] = "ControllerResizeInProgress"
146+
AllocatedResourceStatus map[ResourceName]ClaimResourceStatus
147147
}
148148
```
149149

@@ -155,16 +155,16 @@ reduces the PVC request size, for both CSI and in-tree plugins they are designed
155155

156156
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.
157157

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.
159159

160160
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`.
161161

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`.
163163

164164
When user reduces `pvc.Spec.Resources`, expansion-controller will set `pvc.Status.AllocatedResources` to lower value only if one of the following is true:
165165

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).
168168
3. If `pvc.Status.AllocatedResourceStatus[storage]` is `nil` or `empty` and previous `ControllerExpandVolume` has not succeeded.
169169

170170
![Determining new size](./get_new_size.png)
@@ -183,9 +183,9 @@ The complete expansion and recovery flow of both control-plane and kubelet is do
183183
- User increases 10Gi PVC to 100Gi by changing - `pvc.spec.resources.requests["storage"] = "100Gi"`.
184184
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
185185
- 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`.
187187
- 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`.
189189
- User requests size to 20Gi.
190190
- Expansion controler notices that previous expansion to last known `allocatedresources` failed, so it sets new `allocatedResources` to `20G`
191191
- 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
195195
- User increases 10Gi PVC to 100Gi by changing - `pvc.spec.resources.requests["storage"] = "100Gi"`
196196
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
197197
- 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`.
199199
- 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`.
202202
- 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`.
206206
- User requests size to 20Gi.
207207
- Expansion controller starts expanding the volume and sees that last expansion failed on the node and driver does not have control-plane expansion.
208208
- 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`.
210210
- Since expansion operations in control-plane are NO-OP, expansion in control-plane succeeds and `pv.Spec` is set to `20G`.
211211
- 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`.
213213
- Kubelet can now retry expansion and expansion on node succeeds.
214214
- Kubelet sets `pvc.Status.AllocatedResourceStatus['storage']` to empty string and `pvc.Status.Capacity` to new value.
215215
- 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
219219
- User increases 10Gi PVC to 100Gi by changing `pvc.spec.resources.requests["storage"] = "100Gi"`
220220
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
221221
- 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`.
223223
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10Gi until the resize is finished.
224224
- While the storage backend is re-sizing the volume, user requests size 20Gi by changing `pvc.spec.resources.requests["storage"] = "20Gi"`
225225
- 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
234234
- User expands expands the PVC to 100GB.
235235
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `89.9GB` to used quota.
236236
- 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`.
238238
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10.1GB until the resize is finished.
239239
- while resize was in progress - expansion controler crashes and loses state.
240240
- 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
248248
- User increases 10Gi PVC to 100Gi by changing `pvc.spec.resources.requests["storage"] = "100Gi"`
249249
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and adds `90Gi` to used quota.
250250
- 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`.
252252
- At this point -`pv.Spec.Capacity` and `pvc.Status.Capacity` stays at 10Gi until the resize is finished.
253253
- While the storage backend is re-sizing the volume, user requests size 200Gi by changing `pvc.spec.resources.requests["storage"] = "200Gi"`
254254
- 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.
256256
- User reduces size back to `20Gi`.
257257
- Quota controller uses `max(pvc.Status.AllocatedResources, pvc.Spec.Resources)` and *returns* `100Gi` to used quota.
258258
- 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._
447447
* **What are other known failure modes?**
448448
For each of them fill in the following information by copying the below template:
449449
- 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`.
451451
- Mitigations: This should not affect any of existing PVCs but this was already broken in some sense and if volume has been
452452
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`.
454454
- Testing: There are some unit tests for this failure mode.
455455

456456
* **What steps should be taken if SLOs are not being met to determine the problem?**

0 commit comments

Comments
 (0)