quickstart-sample-csi-driver

module
v0.0.0-...-22241e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: MIT

README

Description

CSI driver for mounting a volume provided by the driver inside a pod.

Getting started

  1. Decide the name for your CSI driver. It should be a standard/sanitized name that doesn't contain dangerous characters.
  2. Create a gRPC server which listens on a specific port.
  3. Start implementing the methods defined in CSI spec, initial implementation can just be an empty function definition.
  4. You may verify whether you have added required implementations as expected using csc tool. More details on how to test using csc can be found in csc.md.
  5. NodeGetInfo() and GetPluginInfo() functions need to be have valid implementations for the driver to get registered.
    • The parameter values can be passed in from config or hard-coded (not recommended).
    • GetPluginInfo() configures the driver name and version.
    • NodeGetInfo() returns the node ID in response.
  6. Register the Node and Identity components using csi library like csi.RegisterIdentityServer(serverOptions, driverOptions).
  7. Logic for mount and unmount volume operations goes in NodePublishVolume() and NodeUnpublishVolume() functions.
  8. Docs for Configuring and Deploying your application explains how to setup and get your app running.
  9. After the deployment completes, you may verify if your driver is functional by following verification docs

ToDo

Create a directory on the host and mount it.

  • Setup gRPC server
  • Expose Controller, Node and Identity Service RPCs
  • Identity Service implemented
  • Node Service implemented
    • NodePublishVolume implemented
      • Volume corresponding to the volume_id published(mounted) at specified target_path
    • NodeUnpublishVolume implemented
      • This RPC is a reverse operation of NodePublishVolume.
    • NodeGetCapabilities implemented

Development

Build and push image

Build docker image
make build TAG="your-tag"
Push docker image to registry
make push TAG="your-tag"
Load docker image in kind cluster
make load TAG="your-tag"

Run/Deploy CSI driver

Run the application in docker container
make run TAG="your-tag"
Deploy manifests on kind cluster
make deploy-kind TAG="your-tag"

Cleanup

Delete all resources from kind cluster

make remove-kind TAG="your-tag"

References

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL