Documentation
¶
Overview ¶
* csimanager manages locally running CSI Plugins on a Nomad host, and provides a few different interfaces.
It provides:
- a pluginmanager.PluginManager implementation that is used to fingerprint and heartbeat local node plugins
- (TODO) a csimanager.AttachmentWaiter implementation that can be used to wait for an external CSIVolume to be attached to the node before returning
- (TODO) a csimanager.NodeController implementation that is used to manage the node-local portions of the CSI specification, and encompassess volume staging/publishing
- (TODO) a csimanager.VolumeChecker implementation that can be used by hooks to ensure their volumes are healthy(ish)
Index ¶
- Constants
- type Config
- type Manager
- type MockCSIManager
- func (m *MockCSIManager) ManagerForPlugin(ctx context.Context, pluginID string) (VolumeManager, error)
- func (m *MockCSIManager) PluginManager() pluginmanager.PluginManager
- func (m *MockCSIManager) Shutdown()
- func (m *MockCSIManager) WaitForPlugin(ctx context.Context, pluginType, pluginID string) error
- type MockExpandVolumeCall
- type MockVolumeManager
- func (m *MockVolumeManager) ExpandVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions, ...) (int64, error)
- func (m *MockVolumeManager) ExternalID() string
- func (m *MockVolumeManager) HasMount(ctx context.Context, mountInfo *MountInfo) (bool, error)
- func (m *MockVolumeManager) MountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation, ...) (*MountInfo, error)
- func (m *MockVolumeManager) UnmountVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions) error
- type MountInfo
- type TriggerNodeEvent
- type UpdateNodeCSIInfoFunc
- type UsageOptions
- type VolumeManager
Constants ¶
View Source
const ( DefaultMountActionTimeout = 2 * time.Minute StagingDirName = "staging" AllocSpecificDirName = "per-alloc" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Logger hclog.Logger
DynamicRegistry dynamicplugins.Registry
UpdateNodeCSIInfoFunc UpdateNodeCSIInfoFunc
PluginResyncPeriod time.Duration
TriggerNodeEvent TriggerNodeEvent
}
type Manager ¶
type Manager interface {
// PluginManager returns a PluginManager for use by the node fingerprinter.
PluginManager() pluginmanager.PluginManager
// WaitForPlugin waits for the plugin to become available,
// or until its context is canceled or times out.
WaitForPlugin(ctx context.Context, pluginType, pluginID string) error
// ManagerForPlugin returns a VolumeManager for the plugin ID associated
// with the volume. Returns an error if this plugin isn't registered.
ManagerForPlugin(ctx context.Context, pluginID string) (VolumeManager, error)
// Shutdown shuts down the Manager and unmounts any locally attached volumes.
Shutdown()
}
type MockCSIManager ¶
type MockCSIManager struct {
VM *MockVolumeManager
NextWaitForPluginErr error
NextManagerForPluginErr error
}
MockCSIManager is a test double for Manager.
func (*MockCSIManager) ManagerForPlugin ¶
func (m *MockCSIManager) ManagerForPlugin(ctx context.Context, pluginID string) (VolumeManager, error)
func (*MockCSIManager) PluginManager ¶
func (m *MockCSIManager) PluginManager() pluginmanager.PluginManager
func (*MockCSIManager) Shutdown ¶
func (m *MockCSIManager) Shutdown()
func (*MockCSIManager) WaitForPlugin ¶
func (m *MockCSIManager) WaitForPlugin(ctx context.Context, pluginType, pluginID string) error
type MockExpandVolumeCall ¶
type MockExpandVolumeCall struct {
VolID string
RemoteID string
AllocID string
UsageOpts *UsageOptions
Capacity *csi.CapacityRange
}
MockExpandVolumeCall captures ExpandVolume arguments for assertions.
type MockVolumeManager ¶
type MockVolumeManager struct {
CallCounter *testutil.CallCounter
Mounts map[string]bool
NextMountVolumeErr error
NextUnmountVolumeErr error
NextHasMountErr error
NextExpandVolumeErr error
LastExpandVolumeCall *MockExpandVolumeCall
ExternalIDValue string
}
MockVolumeManager is a test double for VolumeManager.
func (*MockVolumeManager) ExpandVolume ¶
func (m *MockVolumeManager) ExpandVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions, capacity *csi.CapacityRange) (int64, error)
func (*MockVolumeManager) ExternalID ¶
func (m *MockVolumeManager) ExternalID() string
func (*MockVolumeManager) MountVolume ¶
func (m *MockVolumeManager) MountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation, usageOpts *UsageOptions, publishContext map[string]string) (*MountInfo, error)
func (*MockVolumeManager) UnmountVolume ¶
func (m *MockVolumeManager) UnmountVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions) error
type TriggerNodeEvent ¶
type UpdateNodeCSIInfoFunc ¶
UpdateNodeCSIInfoFunc is the callback used to update the node from fingerprinting
type UsageOptions ¶
type UsageOptions struct {
ReadOnly bool
AttachmentMode structs.CSIVolumeAttachmentMode
AccessMode structs.CSIVolumeAccessMode
MountOptions *structs.CSIMountOptions
}
func (*UsageOptions) ToFS ¶
func (u *UsageOptions) ToFS() string
ToFS is used by a VolumeManager to construct the path to where a volume should be staged/published. It should always return a string that is easy enough to manage as a filesystem path segment (e.g avoid starting the string with a special character).
type VolumeManager ¶
type VolumeManager interface {
MountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation, usageOpts *UsageOptions, publishContext map[string]string) (*MountInfo, error)
UnmountVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions) error
HasMount(ctx context.Context, mountInfo *MountInfo) (bool, error)
ExpandVolume(ctx context.Context, volID, remoteID, allocID string, usageOpts *UsageOptions, capacity *csi.CapacityRange) (int64, error)
ExternalID() string
}
Click to show internal directories.
Click to hide internal directories.