Skip to content

Add controller capability to advertise whether mount, block, or both types of Volumes may be created #565

Open
@ebblake

Description

Is your feature request related to a problem?/Why is this needed

While implementing a new CSI driver (KubeSAN), we initially implemented a block-only setup (that is, any VolumeCapability used to create a volume must include access_type.block; because the driver rejects access_type.mount fails with InvalidArgument).

The csi-sanity testsuite defaults to Mount (filesystem) volumes, but supports --csi-testvolumeaccesstype block to switch the testing to just creation of block volumes instead. But it would be nice if it could determine which type(s) are supported by the driver, and test the correct one(s) automatically; in particular, it would be nice for csi-sanity to prove that it is not possible to create a volume clone where the clone requested VolumeCapability.access_type.mount but the source snapshot or volume had access_type.block, and vice versa.

See also kubernetes-csi/csi-test#541

Describe the solution you'd like in detail

My initial idea: in ControllerGetCapabilities, expand the exisitng

message ControllerServiceCapability {
...
  oneof type {
    // RPC that the controller supports.
    RPC rpc = 1;
  }
}

to add a new capability-with-value that advertises the type(s) of volumes that the driver is capable of creating. Something like:

message ControllerServiceCapability {
...
  // Optional, although recommended if the controller advertises CREATE_DELETE_VOLUME.
  // If advertised, the CO must assume that any volume creation attempt not using one of the advertised types will fail with INVALID_ARGUMENT
  message SupportedVolumeAccessTypes {
    enum Type {
      // The controller supports VolumeCapability.access_type.block
      block = 1;
      // The controller supports VolumeCapability.access_type.mount
      mount = 2;
    }

    repeated Type type = 1;
  }
  oneof type {
    // RPC that the controller supports.
    RPC rpc = 1;
    // Set of volume types explicitly supported by the controller.
    SupportedVolumeAccessTypes supported_volume_access_types = 2;
  }
}

Describe alternatives you've considered

Right now, the CO has to know in advance which type(s) of volumes may be handled, and merely deal with the InvalidArgument errors returned when the CreateVolume or similar request passes in an unsupported type.

Additional context

Here's a link to KubeSAN trying to implement Mount support: https://gitlab.com/kubesan/kubesan/-/merge_requests/45

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions