@@ -98,12 +98,9 @@ tags, and then generate with `hack/update-toc.sh`.
98
98
- [ Upgrade / Downgrade Strategy] ( #upgrade--downgrade-strategy )
99
99
- [ Version Skew Strategy] ( #version-skew-strategy )
100
100
- [ Production Readiness Review Questionnaire] ( #production-readiness-review-questionnaire )
101
- - [ Scalability] ( #scalability )
102
- - [ Troubleshooting] ( #troubleshooting )
103
101
- [ Implementation History] ( #implementation-history )
104
102
- [ Drawbacks] ( #drawbacks )
105
103
- [ Alternatives] ( #alternatives )
106
- - [ Infrastructure Needed (optional)] ( #infrastructure-needed-optional )
107
104
<!-- /toc -->
108
105
109
106
## Release Signoff Checklist
@@ -187,7 +184,8 @@ demonstrate the interest in a KEP within the wider Kubernetes community.
187
184
188
185
### Goals
189
186
190
- Provide a feature to auto delete the PVCs created by StatefulSet.
187
+ Provide a feature to auto delete the PVCs created by StatefulSet.
188
+ Ensure that the pod restarts due to non scale down events such as rolling update or node drain does not delete the PVC.
191
189
192
190
<!--
193
191
List the specific goals of the KEP. What is it trying to achieve? How will we
@@ -223,13 +221,12 @@ The following changes are required:
223
221
* Retain - this is the default policy and is considered in cases where no policy is specified.
224
222
This would be the existing behaviour - when a StatefulSet is deleted, no action is taken with
225
223
respect to the PVCs created by the StatefulSet.
226
- * RemoveOnScaledown - Whenever a pod is deleted, the corresponding PVC is deleted as well.
227
- When a scale down occurs for the StatefulSet, the corresponding PVC is deleted. A scale up
228
- following a scale down, will wait till old PVC for the removed Pod is deleted and ensure
224
+ * RemoveOnScaledown - When a pod is deleted on scale down, the corresponding PVC is deleted as well.
225
+ A scale up following a scale down, will wait till old PVC for the removed Pod is deleted and ensure
229
226
that the PVC used is a freshly created one.
230
227
* RemoveOnStatefulSetDeletion - PVCs corresponding to the StatefulSet are deleted when StatefulSet
231
228
themselves get deleted.
232
- 3 . Add ` patch ` to the statefulset controller cluster role.
229
+ 3 . Add ` patch ` to the statefulset controller rbac cluster role for ` persistentvolumeclaims ` .
233
230
234
231
<!--
235
232
This is where we get down to the specifics of what the proposal actually is.
@@ -252,7 +249,7 @@ bogged down.
252
249
User environment is such at the content of the PVCs which are created automatically during StatefulSet
253
250
creation need not be retained after the StatefulSet is deleted. User also requires that the scale
254
251
up/down occurs in a fast manner, and leverages any previously existing auto created PVCs within the
255
- life time of the StatefulSet. A provision needs to be provided for the user to auto-delete the PVCs
252
+ life time of the StatefulSet. An option needs to be provided for the user to auto-delete the PVCs
256
253
once the StatefulSet is deleted.
257
254
258
255
User would set the VolumeReclaimPolicy as 'RemoveOnStatefulSetDelete' which would ensure that
@@ -306,20 +303,20 @@ will be added to the StatefulSet. This field represents the user indication on w
306
303
associated PVCs can be deleted or not. If this field is not set, the default behaviour is
307
304
to leave the PVCs as is during the StatefulSet deletion.
308
305
309
- If ` VolumeReclaimPolicy ` is set to ` RemoveOnScaledown ` Pod is set as the owner of the PVCs created
310
- from the ` VolumeClaimTemplates ` . When a Pod is deleted, the PVC owned by the Pod is
311
- also deleted.
306
+ If ` VolumeReclaimPolicy ` is set to ` RemoveOnScaledown ` , Pod is set as the owner of the PVCs created
307
+ from the ` VolumeClaimTemplates ` just before the scale down is performed by the statefulset controller.
308
+ When a Pod is deleted, the PVC owned by the Pod is also deleted.
309
+
310
+ Current scaleset controller implementation ensures that the manually deleted pods are restored
311
+ before the scale down logic is run. This combined with the fact that the owner references are set
312
+ only before the scale down will ensure that manual deletions do not automatically delete the PVCs
313
+ in question.
312
314
313
315
During scale-up, if a PVC has an OwnerRef that does not match the Pod, it
314
316
potentially indicates that the PVC is referred by the deleted Pod and is in the process of
315
317
getting deleted. Controller will exit the current reconcile loop and attempt to reconcile in the
316
318
next iteration. This avoids a race with PVC deletion.
317
319
318
- Current scaleset controller implementation ensures that the manually deleted pods are restored
319
- before the scale down logic is run. The Pod owner reference is only added to the PVC just
320
- before the scaling down by the controller. This ensures that the manual deletions do not
321
- automatically delete the PVCs in question.
322
-
323
320
When ` VolumeReclaimPolicy ` is set to ` RemoveOnStatefulSetDeletion ` the owner reference in
324
321
PVC points to the StatefulSet. When a scale up or down occurs, the PVC would remain the same.
325
322
PVCs previously in use before scale down will be used again when the scale up occurs. The PVC deletion
0 commit comments