Skip to content

Commit 8006434

Browse files
committed
volumeClaimTemplates
1 parent fb23e41 commit 8006434

File tree

1 file changed

+24
-23
lines changed
  • keps/sig-storage/4650-stateful-set-update-claim-template

1 file changed

+24
-23
lines changed

keps/sig-storage/4650-stateful-set-update-claim-template/README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ tags, and then generate with `hack/update-toc.sh`.
107107
- [Implementation History](#implementation-history)
108108
- [Drawbacks](#drawbacks)
109109
- [Alternatives](#alternatives)
110-
- [extensively validate the updated <code>volumeClaimTemplate</code>](#extensively-validate-the-updated-volumeclaimtemplate)
111-
- [Only support for updating <code>volumeClaimTemplate.spec.resources.requests.storage</code>](#only-support-for-updating-volumeclaimtemplatespecresourcesrequestsstorage)
110+
- [Extensively validate the updated <code>volumeClaimTemplates</code>](#extensively-validate-the-updated-volumeclaimtemplates)
111+
- [Only support for updating storage size](#only-support-for-updating-storage-size)
112112
- [Infrastructure Needed (Optional)](#infrastructure-needed-optional)
113113
<!-- /toc -->
114114

@@ -175,8 +175,8 @@ updates.
175175
[documentation style guide]: https://github.com/kubernetes/community/blob/master/contributors/guide/style-guide.md
176176
-->
177177

178-
Kubernetes does not support the modification of the `volumeClaimTemplate` of a StatefulSet currently.
179-
This enhancement proposes to support arbitrary modifications to the `volumeClaimTemplate`,
178+
Kubernetes does not support the modification of the `volumeClaimTemplates` of a StatefulSet currently.
179+
This enhancement proposes to support arbitrary modifications to the `volumeClaimTemplates`,
180180
automatically updating the associated PersistentVolumeClaim objects in-place if applicable.
181181
Currently, PVC `spec.resources.requests.storage` and `spec.volumeAttributesClassName`
182182
fields can be updated in-place.
@@ -211,7 +211,7 @@ This brings many headaches in a continuously evolving environment.
211211
List the specific goals of the KEP. What is it trying to achieve? How will we
212212
know that this has succeeded?
213213
-->
214-
* Allow users to update the `volumeClaimTemplate` of a `StatefulSet` in place.
214+
* Allow users to update the `volumeClaimTemplates` of a `StatefulSet` in place.
215215
* Automatically update the associated PersistentVolumeClaim objects in-place if applicable.
216216
* Support updating PersistentVolumeClaim objects with `OnDelete` strategy.
217217
* Coordinate updates to `Pod` and PersistentVolumeClaim objects.
@@ -224,7 +224,7 @@ What is out of scope for this KEP? Listing non-goals helps to focus discussion
224224
and make progress.
225225
-->
226226
* Support automatic rolling update of PersistentVolumeClaim.
227-
* Validate the updated `volumeClaimTemplate` as how PVC update does.
227+
* Validate the updated `volumeClaimTemplates` as how PVC update does.
228228
* Update ephemeral volumes.
229229

230230

@@ -238,7 +238,7 @@ implementation. What is the desired outcome and how do we measure success?.
238238
The "Design Details" section below is for the real
239239
nitty-gritty.
240240
-->
241-
1. Change API server to allow any updates to `volumeClaimTemplate` of a StatefulSet.
241+
1. Change API server to allow any updates to `volumeClaimTemplates` of a StatefulSet.
242242

243243
2. Modify StatefulSet controller to add PVC reconciliation logic.
244244

@@ -283,7 +283,7 @@ both for in-place update and for the PVCs that need manual intervention.
283283

284284
How to update PVCs:
285285
1. If `volumeClaimUpdateStrategy` is `InPlace`,
286-
and if `volumeClaimTemplate` and actual PVC only differ in mutable fields
286+
and if `volumeClaimTemplates` and actual PVC only differ in mutable fields
287287
(`spec.resources.requests.storage`, `spec.volumeAttributesClassName`, `metadata.labels`, and `metadata.annotations` currently),
288288
update the PVC in-place to the extent possible.
289289
Do not perform the update that will be rejected by API server, such as
@@ -299,14 +299,14 @@ Tested on Kubernetes v1.28, and I can see this event:
299299
Warning FailedCreate 3m58s (x7 over 3m58s) statefulset-controller create Pod test-rwop-0 in StatefulSet test-rwop failed error: pvc data-test-rwop-0 is being deleted
300300
-->
301301

302-
3. Use either current or updated revision of the `volumeClaimTemplate` to create/update the PVC,
302+
3. Use either current or updated revision of the `volumeClaimTemplates` to create/update the PVC,
303303
just like Pod template.
304304

305305
When to update PVCs:
306306
1. If `volumeClaimSyncStrategy` is `LockStep`,
307307
before advancing `status.updatedReplicas` to the next replica,
308308
additionally check that the PVCs of the next replica are
309-
[compatible](#what-pvc-is-compatible) with the new `volumeClaimTemplate`.
309+
[compatible](#what-pvc-is-compatible) with the new `volumeClaimTemplates`.
310310
If not, and we are not going to update it in-place automatically,
311311
wait for the user to delete/update the old PVC manually.
312312

@@ -336,7 +336,7 @@ Failure cases: don't left too many PVCs being updated in-place. We expect to upd
336336
We should update status, just like what we do when waiting for Pod to be ready.
337337
We should block the update process if the PVC is never compatible.
338338

339-
- If the `volumeClaimTemplate` is updated again when the previous rollout is blocked,
339+
- If the `volumeClaimTemplates` is updated again when the previous rollout is blocked,
340340
similar to [Pods](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#forced-rollback),
341341
user may need to manually deal with the blocking PVCs (update or delete them).
342342

@@ -372,7 +372,7 @@ All the test, review, approval, and rollback process can be reused.
372372
We decide to switch from home-made local storage to the storage provided by a cloud provider.
373373
We can not afford any downtime, so we don't want to delete and recreate the StatefulSet.
374374
Our app can automatically rebuild the data in the new storage from other replicas.
375-
So we update the `volumeClaimTemplate` of the StatefulSet,
375+
So we update the `volumeClaimTemplates` of the StatefulSet,
376376
delete the PVC and Pod of one replica, let the controller re-create them,
377377
then monitor the rebuild process.
378378
Once the rebuild completes successfully, we proceed to the next replica.
@@ -395,7 +395,7 @@ The same process as Story 2 can be used.
395395

396396
The storage requirement of different replicas are not identical,
397397
so we still want to update each PVC manually and separately.
398-
Possibly we also update the `volumeClaimTemplate` for new replicas,
398+
Possibly we also update the `volumeClaimTemplates` for new replicas,
399399
but we don't want the controller to interfere with the existing replicas.
400400

401401
### Notes/Constraints/Caveats (Optional)
@@ -413,20 +413,20 @@ we wait for the PVC to be compatible whenever we would wait for the Pod to be re
413413

414414
`volumeClaimSyncStrategy` is introduce to keep capability of current deployed workloads.
415415
StatefulSet currently accepts and uses existing PVCs that is not created by the controller,
416-
So the `volumeClaimTemplate` and PVC can differ even before this enhancement.
416+
So the `volumeClaimTemplates` and PVC can differ even before this enhancement.
417417
Some users may choose to keep the PVCs of different replicas different.
418418
We should not block the Pod updates for them.
419419

420420
If `volumeClaimSyncStrategy` is `Async`,
421-
we just ignore the PVCs that cannot be updated to be compatible with the new `volumeClaimTemplate`,
421+
we just ignore the PVCs that cannot be updated to be compatible with the new `volumeClaimTemplates`,
422422
as what we do currently.
423423
Of course, we report this in the status of the StatefulSet.
424424

425425
However, a workload may rely on some features provided by a specific PVC,
426426
So we should provide a way to coordinate the update.
427427
That's why we also need `LockStep`.
428428

429-
The StatefulSet controller should also keeps the current and updated revision of the `volumeClaimTemplate`,
429+
The StatefulSet controller should also keeps the current and updated revision of the `volumeClaimTemplates`,
430430
so that a `LockStep` StatefulSet can still re-create Pods and PVCs that are yet-to-be-updated.
431431

432432
### Risks and Mitigations
@@ -1006,29 +1006,30 @@ What other approaches did you consider, and why did you rule them out? These do
10061006
not need to be as detailed as the proposal, but should include enough
10071007
information to express the idea and why it was not acceptable.
10081008
-->
1009-
### extensively validate the updated `volumeClaimTemplate`
1009+
### Extensively validate the updated `volumeClaimTemplates`
10101010

1011-
[KEP-0661] proposes that we should do extensive validation on the updated `volumeClaimTemplate`.
1011+
[KEP-0661] proposes that we should do extensive validation on the updated `volumeClaimTemplates`.
10121012
e.g., prevent decreasing the storage size, preventing expand if the storage class does not support it.
10131013
However, this have saveral drawbacks:
1014-
* Not reverting the `volumeClaimTemplate` when rollback the StatefulSet is confusing,
1014+
* Not reverting the `volumeClaimTemplates` when rollback the StatefulSet is confusing,
10151015
* The validation can be a barrier when recovering from a failed update.
10161016
If RecoverVolumeExpansionFailure feature gate is enabled, we can recover from failed expansion by decreasing the size.
10171017
* The validation is racy, especially when recovering from failed expansion.
10181018
We still need to consider most abnormal cases even we do those validations.
10191019
* This does not match the pattern of existing behaviors.
10201020
That is, the controller should take the expected state, retry as needed to reach that state.
10211021
For example, StatefulSet will not reject a invalid `serviceAccountName`.
1022-
* `volumeClaimTemplate` is also used when creating new PVCs, so even if the existing PVCs cannot be updated,
1022+
* `volumeClaimTemplates` is also used when creating new PVCs, so even if the existing PVCs cannot be updated,
10231023
a user may still want to affect new PVCs.
10241024

1025-
### Only support for updating `volumeClaimTemplate.spec.resources.requests.storage`
1025+
### Only support for updating storage size
10261026

1027-
[KEP-0661] only enables expanding the volume. However, because the StatefulSet can take pre-existing PVCs,
1027+
[KEP-0661] only enables expanding the volume by updating `volumeClaimTemplates[*].spec.resources.requests.storage`.
1028+
However, because the StatefulSet can take pre-existing PVCs,
10281029
we still need to consider what to do when template and PVC don't match.
10291030
The complexity of this proposal will not decrease much if we only support expanding the volume.
10301031

1031-
By enabling arbitrary updating to the `volumeClaimTemplate`,
1032+
By enabling arbitrary updating to the `volumeClaimTemplates`,
10321033
we just acknowledge and officially support this use case.
10331034

10341035
[KEP-0661]: https://github.com/kubernetes/enhancements/pull/3412

0 commit comments

Comments
 (0)