driver

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

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

	// ZoneTopologyKey is the topology key used to provision volumes.
	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 ExtractIDAndZone

func ExtractIDAndZone(id string) (string, scw.Zone, error)

ExtractIDAndZone takes a zonal ID and returns the ID and zone of a resource.

func UserAgent

func UserAgent() (userAgent string)

UserAgent returns the CSI driver user-agent.

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

	// Unmount unmounts the given target.
	Unmount(target 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)

	// IsMounted returns true is `devicePath` has a device mounted.
	IsMounted(targetPath string) bool

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

	// Resize resizes the given volumes, it will try to resize the LUKS device first if the passphrase is provided.
	Resize(targetPath string, devicePath, passphrase string) error

	// IsEncrypted returns true if the device with the given path is encrypted with LUKS.
	IsEncrypted(devicePath string) (bool, error)

	// EncryptAndOpenDevice encrypts the volume with the given ID with the given passphrase and opens 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) ControllerGetVolume

func (d Driver) ControllerGetVolume(ctx context.Context, req *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error)

ControllerGetVolume gets a specific volume.

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 deprovisions 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 is the path to the CSI endpoint.
	Endpoint string
	// Prefix added to the name of newly created volumes.
	Prefix string
	// Plugin mode.
	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
y or Y : Canonical URL