driver

package
Version: v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DriverName is the official name for the Scaleway CSI plugin
	DriverName      = "csi.scaleway.com"
	ZoneTopologyKey = "topology." + DriverName + "/zone"

	// ExtraUserAgentEnv is the environment variable that adds some string at the end of the user agent
	ExtraUserAgentEnv = "EXTRA_USER_AGENT"
)

Variables

This section is empty.

Functions

func GetVersionJSON

func GetVersionJSON() (string, error)

GetVersionJSON returns the current running version in JSON

Types

type DiskUtils

type DiskUtils interface {
	// FormatAndMount tries to mount `devicePath` on `targetPath` as `fsType` with `mountOptions`
	// If it fails it will try to format `devicePath` as `fsType` first and retry
	FormatAndMount(targetPath string, devicePath string, fsType string, mountOptions []string) error

	// MountToTarget tries to mount `sourcePath` on `targetPath` as `fsType` with `mountOptions`
	MountToTarget(sourcePath, targetPath, fsType string, mountOptions []string) error

	// IsBlockDevice returns true if `path` is a block device
	IsBlockDevice(path string) (bool, error)

	// GetDevicePath returns the path for the specified volumeID
	GetDevicePath(volumeID string) (string, error)

	// IsSharedMounted returns true is `devicePath` is shared mounted on `targetPath`
	IsSharedMounted(targetPath string, devicePath string) (bool, error)

	// GetMountInfo returns a mount informations for `targetPath`
	// taken from https://github.com/kubernetes/kubernetes/blob/master/pkg/util/mount/mount_linux.go
	GetMountInfo(targetPath string) (*mountInfo, error)

	// GetStatfs return the statfs struct for the given path
	GetStatfs(path string) (*unix.Statfs_t, error)

	// Resize resizes the given volumes
	Resize(targetPath string, devicePath string) error

	// EncryptAndOpenDevice encrypts the volume with the given ID with the given passphrase and open it
	// If the device is already encrypted (LUKS header present), it will only open the device
	EncryptAndOpenDevice(volumeID string, passphrase string) (string, error)

	// CloseDevice closes the encrypted device with the given ID
	CloseDevice(volumeID string) error

	// GetMappedDevicePath returns the path on where the encrypted device with the given ID is mapped
	GetMappedDevicePath(volumeID string) (string, error)
}

type Driver

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

Driver implements the interfaces csi.IdentityServer, csi.ControllerServer and csi.NodeServer

func NewDriver

func NewDriver(config *DriverConfig) (*Driver, error)

NewDriver returns a CSI plugin

func (*Driver) ControllerExpandVolume

func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)

ControllerExpandVolume expands the given volume

func (*Driver) ControllerGetCapabilities

func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)

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

func (*Driver) ControllerPublishVolume

func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)

ControllerPublishVolume perform the work that is necessary for making the volume available on the given node. This operation MUST be idempotent.

func (*Driver) ControllerUnpublishVolume

func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)

ControllerUnpublishVolume is the reverse operation of ControllerPublishVolume This operation MUST be idempotent.

func (*Driver) CreateSnapshot

func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)

CreateSnapshot creates a snapshot of the given volume

func (*Driver) CreateVolume

func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)

CreateVolume creates a new volume with the given CreateVolumeRequest. This function is idempotent

func (*Driver) DeleteSnapshot

func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)

DeleteSnapshot deletes the given snapshot

func (*Driver) DeleteVolume

func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)

DeleteVolume deprovision a volume. This operation MUST be idempotent.

func (*Driver) GetCapacity

func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)

GetCapacity returns the capacity of the storage pool from which the controller provisions volumes.

func (*Driver) GetPluginCapabilities

GetPluginCapabilities allows to query the supported capabilities of the Plugin as a whole

func (*Driver) GetPluginInfo

func (d *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

GetPluginInfo returns metadata about the plugin

func (*Driver) ListSnapshots

func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)

ListSnapshots return the information about all snapshots on the storage system within the given parameters regardless of how they were created. ListSnapshots SHALL NOT list a snapshot that is being created but has not been cut successfully yet.

func (*Driver) ListVolumes

func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)

ListVolumes returns the list of the requested volumes

func (*Driver) NodeExpandVolume

func (d *Driver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)

NodeExpandVolume expands the given volume

func (*Driver) NodeGetCapabilities

func (d *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)

NodeGetCapabilities allows the CO to check the supported capabilities of node service provided by the Plugin.

func (*Driver) NodeGetInfo

func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)

NodeGetInfo returns information about node's volumes

func (*Driver) NodeGetVolumeStats

func (d *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)

NodeGetVolumeStats returns the volume capacity statistics available for the volume

func (*Driver) NodePublishVolume

func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)

NodePublishVolume is called by the CO when a workload that wants to use the specified volume is placed (scheduled) on a node. The Plugin SHALL assume that this RPC will be executed on the node where the volume will be used.

func (*Driver) NodeStageVolume

func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)

NodeStageVolume is called by the CO prior to the volume being consumed by any workloads on the node by NodePublishVolume. The Plugin SHALL assume that this RPC will be executed on the node where the volume will be used. This RPC SHOULD be called by the CO when a workload that wants to use the specified volume is placed (scheduled) on the specified node for the first time or for the first time since a NodeUnstageVolume call for the specified volume was called and returned success on that node.

func (*Driver) NodeUnpublishVolume

func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)

NodeUnpublishVolume is a reverse operation of NodePublishVolume. This RPC MUST undo the work by the corresponding NodePublishVolume.

func (*Driver) NodeUnstageVolume

func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)

NodeUnstageVolume is a reverse operation of NodeStageVolume. It must undo the work by the corresponding NodeStageVolume.

func (*Driver) Probe

func (d *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

Probe allows to verify that the plugin is in a healthy and ready state

func (*Driver) Run

func (d *Driver) Run() error

Run starts the CSI plugin on the given endpoint

func (*Driver) ValidateVolumeCapabilities

func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)

ValidateVolumeCapabilities check if a pre-provisioned volume has all the capabilities that the CO wants. This RPC call SHALL return confirmed only if all the volume capabilities specified in the request are supported. This operation MUST be idempotent.

type DriverConfig

type DriverConfig struct {
	Endpoint string
	Prefix   string
	Mode     Mode
}

DriverConfig is used to configure a new Driver

type Mode

type Mode string

Mode represents the mode in which the CSI driver started

const (
	// ControllerMode represents the controller mode
	ControllerMode Mode = "controller"
	// NodeMode represents the node mode
	NodeMode Mode = "node"
	// AllMode represents the the controller and the node mode at the same time
	AllMode Mode = "all"
)

type VersionInfo

type VersionInfo struct {
	DriverVersion string `json:"driverVersion"`
	GitCommit     string `json:"gitCommit"`
	BuildDate     string `json:"buildDate"`
	GoVersion     string `json:"goVersion"`
	Compiler      string `json:"compiler"`
	Platform      string `json:"platform"`
}

VersionInfo represents the current running version

func GetVersion

func GetVersion() VersionInfo

GetVersion returns the current running version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL