container-storage-interface / spec

Container Storage Interface (CSI) Specification.
Apache License 2.0
1.34k stars 373 forks source link

Access modes for single node single/multi writer #476

Closed chrishenzie closed 3 years ago

chrishenzie commented 3 years ago

Access Modes

In the CSI spec there are conflicting definitions of the SINGLE_NODE_WRITER access mode. By definition, SINGLE_NODE_WRITER means "Can only be published once as read/write on a single node, at any given time." The problem is how this access mode is used during NodePublishVolume, which is typically where volume mounting is performed.

The CSI spec defines that when NodePublishVolume is called a second time for a volume with a non-MULTI_NODE access mode and with a different target path, the plugin should return FAILED_PRECONDITION. For CSI plugins that strictly adhere to the spec, this guarantees that a volume can only be mounted to a single target path, which means SINGLE_NODE_WRITER restricts access to a single pod on a single node. This behavior conflicts with the original definition. Due to this conflict, we do not have an access mode that represents multiple writers on the same node. See https://github.com/container-storage-interface/spec/issues/465#issuecomment-739046063 for more details.

The proposed solution for this issue is to introduce two new access modes: SINGLE_NODE_SINGLE_WRITER and SINGLE_NODE_MULTI_WRITER. These access modes exist to replace SINGLE_NODE_WRITER and disambiguate the number of writers on a single node.

Capabilities

Included in this change are capability bits in the controller and node services to indicate that a driver understands these new access modes. This approach was chosen in order to preserve backwards compatibility. When a client calls a CSI driver that supports the SINGLE_NODE_MULTI_WRITER capability, the client should replace any uses of the SINGLE_NODE_WRITER access mode with the appropriate SINGLE_NODE_{SINGLE,MULTI}_WRITER access mode depending on their use case.

chrishenzie commented 3 years ago

@bswartz Would you be able to take a look at this? Thank you!

bswartz commented 3 years ago

/lgtm

gnufied commented 3 years ago

lgtm

jdef commented 3 years ago

thanks for putting this together, looking now..

saad-ali commented 3 years ago

@jdef @humblec @gnufied PTAL

I'd like to merge and cut the next release on Monday.

chrishenzie commented 3 years ago

@jdef Done, addressed comments. Thank you for the review!

humblec commented 3 years ago

lgtm from end. Thanks :+1:

saad-ali commented 3 years ago

LGTM mod comments

lgtm from end. Thanks 👍

Thanks folks. Mergining this PR.