containerized-data-importer icon indicating copy to clipboard operation
containerized-data-importer copied to clipboard

Support ReadWriteOncePod for DataVolumes

Open davidvossel opened this issue 2 years ago • 1 comments

There's a new pvc accessMode called ReadWriteOncePod which means that a PVC can only be accessed by one pod at a time. The ReadWriteOnce accessMode only guaranteed that a single hosted accessed the PVC at a time, but multiple pods could.

It's possible this is as simple as letting the new AccessMode pass validation as outlined in the patch below.

diff --git a/pkg/apiserver/webhooks/datavolume-validate.go b/pkg/apiserver/webhooks/datavolume-validate.go
index 690dbb112..4e28fe5e8 100644
--- a/pkg/apiserver/webhooks/datavolume-validate.go
+++ b/pkg/apiserver/webhooks/datavolume-validate.go
@@ -131,10 +131,10 @@ func (wh *dataVolumeValidatingWebhook) validateDataVolumeSpec(request *admission
                // here in storage spec we allow empty access mode and AccessModes with more than one entry
                accessModes := spec.Storage.AccessModes
                for _, mode := range accessModes {
-                       if mode != v1.ReadWriteOnce && mode != v1.ReadOnlyMany && mode != v1.ReadWriteMany {
+                       if mode != v1.ReadWriteOnce && mode != v1.ReadOnlyMany && mode != v1.ReadWriteMany && mode != v1.ReadWriteOncePod {
                                causes = append(causes, metav1.StatusCause{
                                        Type:    metav1.CauseTypeFieldValueInvalid,
-                                       Message: fmt.Sprintf("Unsupported value: \"%s\": supported values: \"ReadOnlyMany\", \"ReadWriteMany\", \"ReadWriteOnce\"", string(accessModes[0])),
+                                       Message: fmt.Sprintf("Unsupported value: \"%s\": supported values: \"ReadOnlyMany\", \"ReadWriteMany\", \"ReadWriteOnce\", \"ReadWriteOncePod\" ", string(accessModes[0])),
                                        Field:   field.Child("PVC", "accessModes").String(),
                                })
                                return causes

davidvossel avatar Jul 20 '22 19:07 davidvossel

Nice, we had just discussed this yesterday with @mhenriks and created an investigation task. Expansion pod after smart/CSI clones with WFFC might be a problem.

Worth to note its alpha at this point: https://github.com/kubernetes/kubernetes/blob/4885f4d75020621e8d77c367fc073fe01a538ec4/pkg/features/kube_features.go#L991

akalenyu avatar Jul 21 '22 09:07 akalenyu

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Oct 19 '22 10:10 kubevirt-bot

/remove-lifecycle stale

mhenriks avatar Oct 20 '22 00:10 mhenriks

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Jan 18 '23 00:01 kubevirt-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot avatar Feb 17 '23 01:02 kubevirt-bot

/remove-lifecycle rotten

akalenyu avatar Feb 19 '23 09:02 akalenyu

Has ReadWriteOncePod moved to beta yet or is it still alpha?

aglitke avatar Mar 13 '23 13:03 aglitke

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Jun 11 '23 14:06 kubevirt-bot

/remove-lifecycle stale

akalenyu avatar Jun 11 '23 14:06 akalenyu

/assign @akalenyu

akalenyu avatar Jun 19 '23 12:06 akalenyu

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Sep 17 '23 13:09 kubevirt-bot

/remove-lifecycle stale

akalenyu avatar Sep 18 '23 08:09 akalenyu

FYI this feature went beta some months ago https://github.com/kubernetes/kubernetes/pull/114494, @akalenyu do we know if the expansion pod issue you mentioned would be a problem?

alromeros avatar Oct 23 '23 09:10 alromeros

FYI this feature went beta some months ago kubernetes/kubernetes#114494, @akalenyu do we know if the expansion pod issue you mentioned would be a problem?

Yeah, should still be there, although with populators things may be slightly different. With WFFC you'd have the user consuming the target ReadWriteOncePod PVC, so the expansion pod will fail at webhook/scheduling (already occupied by the user's consumer pod)

akalenyu avatar Oct 23 '23 10:10 akalenyu

Yeah, should still be there, although with populators things may be slightly different. With WFFC you'd have the user consuming the target ReadWriteOncePod PVC, so the expansion pod will fail at webhook/scheduling (already occupied by the user's consumer pod)

With populators, the expansion pod is technically consuming a different PVC so there shouldn't be an issue

mhenriks avatar Nov 22 '23 15:11 mhenriks

We discussed this issue again in the January 29 SIG-Storage meeting. It seems the next step would be for someone to create an exploratory PR that allows RWOP access mode and changes the tests to use it. This would help us to learn if CDI has any issues with this access mode. We can add some smoke tests for it but to repeat all of the RWO tests for RWOP seems like overkill.

aglitke avatar Jan 29 '24 13:01 aglitke