csimanager

package
v0.11.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MPL-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	DefaultMountActionTimeout = 2 * time.Minute
	StagingDirName            = "staging"
	AllocSpecificDirName      = "per-alloc"
)

Variables

View Source
var (
	PluginNotFoundErr = errors.New("Plugin not found")
)

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

	// MounterForVolume returns a VolumeMounter for the given requested volume.
	// If there is no plugin registered for this volume type, a PluginNotFoundErr
	// will be returned.
	MounterForVolume(ctx context.Context, volume *structs.CSIVolume) (VolumeMounter, error)

	// Shutdown shuts down the Manager and unmounts any locally attached volumes.
	Shutdown()
}

func New

func New(config *Config) Manager

New returns a new PluginManager that will handle managing CSI plugins from the dynamicRegistry from the provided Config.

type MountInfo

type MountInfo struct {
	Source   string
	IsDevice bool
}

type TriggerNodeEvent

type TriggerNodeEvent func(*structs.NodeEvent)

type UpdateNodeCSIInfoFunc

type UpdateNodeCSIInfoFunc func(string, *structs.CSIInfo)

UpdateNodeCSIInfoFunc is the callback used to update the node from fingerprinting

type UsageOptions

type UsageOptions struct {
	ReadOnly       bool
	AttachmentMode string
	AccessMode     string
	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 VolumeMounter

type VolumeMounter interface {
	MountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation, usageOpts *UsageOptions, publishContext map[string]string) (*MountInfo, error)
	UnmountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation, usageOpts *UsageOptions) error
}

Jump to

Keyboard shortcuts

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