Files
ubicloud/kubernetes/csi/lib/ubi_csi.rb
mohi-kalantari 795c43ec9a Implement node service with local disk volume lifecycle
Add a new node service implementation for the CSI plugin, supporting local disk
backed volumes. The service provides logic for all required node
operations, including stage, unstage, publish, and unpublish.

The node_stage_volume method allocates a sparse file on the VM's local disk,
sets up a loop device, and, if the PVC requests a filesystem, formats and mounts
the device to the staging path. If the PVC requests a block device, only the
loop device is set up, with no formatting or mounting performed.

The node_publish_volume method always bind-mounts the staging path to the
target path, making the volume available to the workload as required by the CSI
specification.

The node_unstage_volume and node_unpublish_volume methods unmount the
staging and target paths, respectively, ensuring proper cleanup of resources
when a volume is no longer needed.

The service respects the requested volume capability, only formatting and
mounting when a filesystem is requested, and otherwise presenting a raw block
device. The node_get_capabilities and node_get_info methods are implemented to
advertise supported node features and provide node identity and volume limits,
using the VM's hostname and a static maximum volume count.
2025-07-25 15:20:55 +02:00

256 B