type csiBlockMapper … var _ … var _ … // GetGlobalMapPath returns a global map path (on the node) to a device file which will be symlinked to // Example: plugins/kubernetes.io/csi/volumeDevices/{specName}/dev func (m *csiBlockMapper) GetGlobalMapPath(spec *volume.Spec) (string, error) { … } // GetStagingPath returns a staging path for a directory (on the node) that should be used on NodeStageVolume/NodeUnstageVolume // Example: plugins/kubernetes.io/csi/volumeDevices/staging/{specName} func (m *csiBlockMapper) GetStagingPath() string { … } // SupportsMetrics returns true for csiBlockMapper as it initializes the // MetricsProvider. func (m *csiBlockMapper) SupportsMetrics() bool { … } // getPublishDir returns path to a directory, where the volume is published to each pod. // Example: plugins/kubernetes.io/csi/volumeDevices/publish/{specName} func (m *csiBlockMapper) getPublishDir() string { … } // getPublishPath returns a publish path for a file (on the node) that should be used on NodePublishVolume/NodeUnpublishVolume // Example: plugins/kubernetes.io/csi/volumeDevices/publish/{specName}/{podUID} func (m *csiBlockMapper) getPublishPath() string { … } // GetPodDeviceMapPath returns pod's device file which will be mapped to a volume // returns: pods/{podUID}/volumeDevices/kubernetes.io~csi, {specName} func (m *csiBlockMapper) GetPodDeviceMapPath() (string, string) { … } // stageVolumeForBlock stages a block volume to stagingPath func (m *csiBlockMapper) stageVolumeForBlock( ctx context.Context, csi csiClient, accessMode v1.PersistentVolumeAccessMode, csiSource *v1.CSIPersistentVolumeSource, attachment *storage.VolumeAttachment, ) (string, error) { … } // publishVolumeForBlock publishes a block volume to publishPath func (m *csiBlockMapper) publishVolumeForBlock( ctx context.Context, csi csiClient, accessMode v1.PersistentVolumeAccessMode, csiSource *v1.CSIPersistentVolumeSource, attachment *storage.VolumeAttachment, ) (string, error) { … } // SetUpDevice ensures the device is attached returns path where the device is located. func (m *csiBlockMapper) SetUpDevice() (string, error) { … } func (m *csiBlockMapper) MapPodDevice() (string, error) { … } var _ … var _ … // unpublishVolumeForBlock unpublishes a block volume from publishPath func (m *csiBlockMapper) unpublishVolumeForBlock(ctx context.Context, csi csiClient, publishPath string) error { … } // unstageVolumeForBlock unstages a block volume from stagingPath func (m *csiBlockMapper) unstageVolumeForBlock(ctx context.Context, csi csiClient, stagingPath string) error { … } // TearDownDevice removes traces of the SetUpDevice. func (m *csiBlockMapper) TearDownDevice(globalMapPath, devicePath string) error { … } // Clean up any orphan files / directories when a block volume is being unstaged. // At this point we can be sure that there is no pod using the volume and all // files are indeed orphaned. func (m *csiBlockMapper) cleanupOrphanDeviceFiles() error { … } // UnmapPodDevice unmaps the block device path. func (m *csiBlockMapper) UnmapPodDevice() error { … }