driver

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WaitTimeout is the default timeout duration used for polling the Linode
	// API, when waiting for a volume to enter an "active" state.
	WaitTimeout = 5 * time.Minute

	// CloneTimeout is the duration to wait when cloning a volume through the
	// Linode API.
	CloneTimeout = 15 * time.Minute
)
View Source
const (
	// VolumeTags is the parameter key used for passing a comma-separated list
	// of tags to the Linode API.
	VolumeTags = Name + "/volumeTags"

	// PublishInfoVolumeName is used to pass the name of the volume as it exists
	// in the Linode API (the "label") to [NodeStageVolume] and
	// [NodePublishVolume].
	PublishInfoVolumeName = Name + "/volume-name"

	// VolumeTopologyRegion is the parameter key used to indicate the region
	// the volume exists in.
	VolumeTopologyRegion string = "topology.linode.com/region"
)
View Source
const (
	// LuksEncryptedAttribute is used to pass the information if the volume should be
	// encrypted with luks to `NodeStageVolume`
	LuksEncryptedAttribute = Name + "/luks-encrypted"

	// LuksCipherAttribute is used to pass the information about the luks encryption
	// cipher to `NodeStageVolume`
	LuksCipherAttribute = Name + "/luks-cipher"

	// LuksKeySizeAttribute is used to pass the information about the luks key size
	// to `NodeStageVolume`
	LuksKeySizeAttribute = Name + "/luks-key-size"

	// LuksKeyAttribute is the key of the luks key used in the map of secrets passed from the CO
	LuksKeyAttribute = "luksKey"
)
View Source
const LinodeIDPath = "/linode-info/linode-id"

LinodeIDPath is the path to a file containing only the ID of the Linode instance the CSI node plugin is currently running on. This file is expected to be placed into the Linode by the init container provided with the CSI node plugin.

View Source
const MaxVolumeLabelPrefixLength = 12

MaxVolumeLabelPrefixLength is the maximum allowed length of a volume label prefix.

View Source
const MinVolumeSizeBytes = 10 << 30 // 10GiB

MinVolumeSizeBytes is the smallest allowed size for a Linode block storage Volume, in bytes.

The CSI RPC scheme deal with bytes, whereas the Linode API's block storage volume endpoints deal with "GB". Internally, the driver will deal with sizes and capacities in bytes, but convert to and from "GB" when interacting with the Linode API.

View Source
const Name = "linodebs.csi.linode.com"

Name is the name of the driver provided by this package. It is also used as the name of the socket file used for container orchestrator and driver communications.

Variables

This section is empty.

Functions

func ControllerServiceCapabilities

func ControllerServiceCapabilities() []*csi.ControllerServiceCapability

ControllerServiceCapabilities returns the list of capabilities supported by this driver's controller service.

func NodeServiceCapabilities

func NodeServiceCapabilities() []*csi.NodeServiceCapability

NodeServiceCapabilities returns the list of capabilities supported by this driver's node service.

func VolumeCapabilityAccessModes

func VolumeCapabilityAccessModes() []*csi.VolumeCapability_AccessMode

VolumeCapabilityAccessModes returns the allowed access modes for a volume created by the driver.

Types

type Command added in v0.8.4

type Command interface {
	utilexec.Cmd
}

type ControllerServer added in v0.8.4

type ControllerServer struct {
	csi.UnimplementedControllerServer
	// contains filtered or unexported fields
}

func NewControllerServer

func NewControllerServer(driver *LinodeDriver, client linodeclient.LinodeClient, metadata Metadata) (*ControllerServer, error)

NewControllerServer instantiates a new RPC service that implements the CSI Controller Service RPC endpoints.

If driver or client are nil, NewControllerServer returns a non-nil error.

func (*ControllerServer) ControllerExpandVolume added in v0.8.4

func (*ControllerServer) ControllerGetCapabilities added in v0.8.4

ControllerGetCapabilities returns the supported capabilities of controller service provided by this Plugin

func (*ControllerServer) ControllerPublishVolume added in v0.8.4

ControllerPublishVolume attaches the given volume to the node

func (*ControllerServer) ControllerUnpublishVolume added in v0.8.4

ControllerUnpublishVolume deattaches the given volume from the node

func (*ControllerServer) CreateVolume added in v0.8.4

CreateVolume will be called by the CO to provision a new volume on behalf of a user (to be consumed as either a block device or a mounted filesystem). This operation is idempotent.

func (*ControllerServer) DeleteVolume added in v0.8.4

DeleteVolume deletes the given volume. The function is idempotent.

func (*ControllerServer) ListVolumes added in v0.8.4

ListVolumes shall return information about all the volumes the provider knows about

func (*ControllerServer) ValidateVolumeCapabilities added in v0.8.4

ValidateVolumeCapabilities checks whether the volume capabilities requested are supported.

type Encryption added in v0.8.4

type Encryption struct {
	Exec       Executor
	FileSystem mountmanager.FileSystem
}

func NewLuksEncryption added in v0.8.4

func NewLuksEncryption(executor utilexec.Interface, fileSystem mountmanager.FileSystem) Encryption

type Executor added in v0.8.4

type Executor interface {
	utilexec.Interface
}

type IdentityServer added in v0.8.4

type IdentityServer struct {
	csi.UnimplementedIdentityServer
	// contains filtered or unexported fields
}

func NewIdentityServer

func NewIdentityServer(linodeDriver *LinodeDriver) (*IdentityServer, error)

func (*IdentityServer) GetPluginCapabilities added in v0.8.4

func (linodeIdentity *IdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)

func (*IdentityServer) GetPluginInfo added in v0.8.4

func (linodeIdentity *IdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

GetPluginInfo(context.Context, *GetPluginInfoRequest) (*GetPluginInfoResponse, error)

func (*IdentityServer) Probe added in v0.8.4

func (linodeIdentity *IdentityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

type LinodeDriver

type LinodeDriver struct {
	// contains filtered or unexported fields
}

func GetLinodeDriver

func GetLinodeDriver() *LinodeDriver

func (*LinodeDriver) Run

func (linodeDriver *LinodeDriver) Run(endpoint string)

func (*LinodeDriver) SetupLinodeDriver

func (linodeDriver *LinodeDriver) SetupLinodeDriver(
	linodeClient linodeclient.LinodeClient,
	mounter *mount.SafeFormatAndMount,
	deviceUtils mountmanager.DeviceUtils,
	metadata Metadata,
	name,
	vendorVersion,
	volumeLabelPrefix string,
	encrypt Encryption,
) error

func (*LinodeDriver) ValidateControllerServiceRequest

func (linodeDriver *LinodeDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) error

type LuksContext

type LuksContext struct {
	EncryptionEnabled bool
	EncryptionKey     string
	EncryptionCipher  string
	EncryptionKeySize string
	VolumeName        string
	VolumeLifecycle   VolumeLifecycle
}

type Metadata

type Metadata struct {
	ID     int    // Instance ID.
	Label  string // The label assigned to the instance.
	Region string // Region the instance is running in.
	Memory uint   // Amount of memory the instance has, in bytes.
}

Metadata contains metadata about the node/instance the CSI node plugin is running on.

func GetMetadata

func GetMetadata(ctx context.Context) (Metadata, error)

GetMetadata retrieves information about the current node/instance from the Linode Metadata Service. If the Metadata Service is unavailable, or this function otherwise returns a non-nil error, callers should call GetMetadataFromAPI.

func GetMetadataFromAPI

func GetMetadataFromAPI(ctx context.Context, client *linodego.Client) (Metadata, error)

GetMetadataFromAPI attempts to retrieve metadata about the current node/instance directly from the Linode API.

type Mounter added in v0.8.4

type Mounter interface {
	mount.Interface
}

TODO: Figure out a better home for these interfaces

type NodeServer added in v0.8.4

type NodeServer struct {
	csi.UnimplementedNodeServer
	// contains filtered or unexported fields
}

func NewNodeServer

func NewNodeServer(linodeDriver *LinodeDriver, mounter *mount.SafeFormatAndMount, deviceUtils mountmanager.DeviceUtils, client linodeclient.LinodeClient, metadata Metadata, encrypt Encryption) (*NodeServer, error)

func (*NodeServer) NodeExpandVolume added in v0.8.4

func (*NodeServer) NodeGetCapabilities added in v0.8.4

func (*NodeServer) NodeGetInfo added in v0.8.4

func (*NodeServer) NodeGetVolumeStats added in v0.8.4

func (*NodeServer) NodePublishVolume added in v0.8.4

func (*NodeServer) NodeStageVolume added in v0.8.4

func (*NodeServer) NodeUnpublishVolume added in v0.8.4

func (*NodeServer) NodeUnstageVolume added in v0.8.4

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer)
	// Waits for the service to stop
	Wait()
	// Stops the service gracefully
	Stop()
	// Stops the service forcefully
	ForceStop()
}

Defines Non blocking GRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

type VolumeLifecycle

type VolumeLifecycle string

VolumeLifecycle is a type used to indicate the phase a volume is at when it is published and/or staged to a node.

const (
	VolumeLifecycleNodeStageVolume     VolumeLifecycle = "NodeStageVolume"
	VolumeLifecycleNodePublishVolume   VolumeLifecycle = "NodePublishVolume"
	VolumeLifecycleNodeUnstageVolume   VolumeLifecycle = "NodeUnstageVolume"
	VolumeLifecycleNodeUnpublishVolume VolumeLifecycle = "NodeUnpublishVolume"
)

Jump to

Keyboard shortcuts

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