Documentation
¶
Overview ¶
Copyright (C) 2022 metal-stack and scaleway authors SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func ConstructMountOptions(mountOptions []string, volCap *csi.VolumeCapability) []string
- func GetFullVersionStr() string
- func GetVersion() string
- func IsMountPoint(p string) (bool, error)
- func IsVolumeReadOnly(capability *csi.VolumeCapability) bool
- func MakeFile(path string) error
- type Config
- type Driver
- func (d *Driver) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
- func (d *Driver) ControllerGetCapabilities(_ context.Context, _ *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
- func (d *Driver) ControllerGetVolume(_ context.Context, _ *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error)
- func (d *Driver) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
- func (d *Driver) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
- func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
- func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
- func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
- func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
- func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
- func (d *Driver) GetLBClient(ctx context.Context, mgmtEPs endpoint.Slice, mgmtScheme string) (lb.Client, error)
- func (d *Driver) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
- func (d *Driver) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
- func (d *Driver) ListSnapshots(_ context.Context, _ *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
- func (d *Driver) ListVolumes(_ context.Context, _ *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
- func (d *Driver) NodeExpandVolume(_ context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
- func (d *Driver) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (d *Driver) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (d *Driver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
- func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
- func (d *Driver) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (d *Driver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
- func (d *Driver) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error)
- func (d *Driver) PutLBClient(clnt lb.Client)
- func (d *Driver) Run() error
- func (d *Driver) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
Constants ¶
const ( KiB int64 = 1024 MiB int64 = 1024 * KiB GiB int64 = 1024 * MiB TiB int64 = 1024 * GiB PiB int64 = 1024 * TiB )
const ( Ext4FS = "ext4" // default XfsFS = "xfs" )
const (
DefaultLUKSCfgFileName = "luks_config.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func ConstructMountOptions ¶
func ConstructMountOptions(mountOptions []string, volCap *csi.VolumeCapability) []string
ConstructMountOptions returns only unique mount options in slice.
func GetFullVersionStr ¶
func GetFullVersionStr() string
func GetVersion ¶
func GetVersion() string
func IsMountPoint ¶
IsMountPoint checks if the given path is mountpoint or not.
func IsVolumeReadOnly ¶
func IsVolumeReadOnly(capability *csi.VolumeCapability) bool
IsVolumeReadOnly checks the access mode in Volume Capability and decides if volume is readonly or not.
Types ¶
type Config ¶
type Config struct { DefaultBackend string BackendCfgPath string // if valid - contents override DefaultBackend. JWTPath string LUKSCfgPath string NodeID string Endpoint string // must be a Unix Domain Socket URI DefaultFS string // one of: ext4, xfs LogLevel string // one of: debug/info/warn/error LogRole string LogTimestamps bool LogFormat string // hidden, dev-only options: BinaryName string Transport string // one of: tcp/rdma SquelchPanics bool PrettyJSON bool RWX bool }
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func (*Driver) ControllerExpandVolume ¶
func (d *Driver) ControllerExpandVolume( ctx context.Context, req *csi.ControllerExpandVolumeRequest, ) (*csi.ControllerExpandVolumeResponse, error)
func (*Driver) ControllerGetCapabilities ¶
func (d *Driver) ControllerGetCapabilities( _ context.Context, _ *csi.ControllerGetCapabilitiesRequest, ) (*csi.ControllerGetCapabilitiesResponse, error)
func (*Driver) ControllerGetVolume ¶
func (d *Driver) ControllerGetVolume( _ context.Context, _ *csi.ControllerGetVolumeRequest, ) (*csi.ControllerGetVolumeResponse, error)
func (*Driver) ControllerPublishVolume ¶
func (d *Driver) ControllerPublishVolume( ctx context.Context, req *csi.ControllerPublishVolumeRequest, ) (*csi.ControllerPublishVolumeResponse, error)
func (*Driver) ControllerUnpublishVolume ¶
func (d *Driver) ControllerUnpublishVolume( ctx context.Context, req *csi.ControllerUnpublishVolumeRequest, ) (*csi.ControllerUnpublishVolumeResponse, error)
func (*Driver) CreateSnapshot ¶
func (d *Driver) CreateSnapshot( ctx context.Context, req *csi.CreateSnapshotRequest, ) (*csi.CreateSnapshotResponse, error)
func (*Driver) CreateVolume ¶
func (d *Driver) CreateVolume( ctx context.Context, req *csi.CreateVolumeRequest, ) (*csi.CreateVolumeResponse, error)
CreateVolume uses info extracted from request `parameters` field to connect to LB and attempt to create the volume specified by `name` field (or return info on an existing volume if one matches, for idempotency). see `lbCreateVolumeParams` for more details on the format.
TODO: on volume "clone" ops, the CSI spec seems to require that the plugin detect "incompatibility between `parameters` from the source and the ones requested for the new volume". unfortunately, the CSI spec does NOT supply the `parameters` of the source as part of the params to this call. it is unspecified how the plugin is supposed to pull this off.
TODO: it's also unclear what's the expected behaviour if a "clone" op is requested for a FS volume with a block mode vol or snap specified as a source. since the capabilities of the source volume are not passed in to this call either, how are plugins expected to detect such cases?
func (*Driver) DeleteSnapshot ¶
func (d *Driver) DeleteSnapshot( ctx context.Context, req *csi.DeleteSnapshotRequest, ) (*csi.DeleteSnapshotResponse, error)
func (*Driver) DeleteVolume ¶
func (d *Driver) DeleteVolume( ctx context.Context, req *csi.DeleteVolumeRequest, ) (*csi.DeleteVolumeResponse, error)
func (*Driver) GetCapacity ¶
func (d *Driver) GetCapacity( ctx context.Context, req *csi.GetCapacityRequest, ) (*csi.GetCapacityResponse, error)
func (*Driver) GetLBClient ¶
func (d *Driver) GetLBClient( ctx context.Context, mgmtEPs endpoint.Slice, mgmtScheme string, ) (lb.Client, error)
GetLBClient conjures up a functional LB mgmt API client by whatever means necessary. the errors it returns are gRPC-grade and can be returned directly to the remote CSI API clients.
func (*Driver) GetPluginCapabilities ¶
func (d *Driver) GetPluginCapabilities( _ context.Context, _ *csi.GetPluginCapabilitiesRequest, ) (*csi.GetPluginCapabilitiesResponse, error)
func (*Driver) GetPluginInfo ¶
func (d *Driver) GetPluginInfo( _ context.Context, _ *csi.GetPluginInfoRequest, ) (*csi.GetPluginInfoResponse, error)
func (*Driver) ListSnapshots ¶
func (d *Driver) ListSnapshots( _ context.Context, _ *csi.ListSnapshotsRequest, ) (*csi.ListSnapshotsResponse, error)
func (*Driver) ListVolumes ¶
func (d *Driver) ListVolumes( _ context.Context, _ *csi.ListVolumesRequest, ) (*csi.ListVolumesResponse, error)
func (*Driver) NodeExpandVolume ¶
func (d *Driver) NodeExpandVolume( _ context.Context, req *csi.NodeExpandVolumeRequest, ) (*csi.NodeExpandVolumeResponse, error)
func (*Driver) NodeGetCapabilities ¶
func (d *Driver) NodeGetCapabilities( _ context.Context, _ *csi.NodeGetCapabilitiesRequest, ) (*csi.NodeGetCapabilitiesResponse, error)
func (*Driver) NodeGetInfo ¶
func (d *Driver) NodeGetInfo( _ context.Context, _ *csi.NodeGetInfoRequest, ) (*csi.NodeGetInfoResponse, error)
func (*Driver) NodeGetVolumeStats ¶
func (d *Driver) NodeGetVolumeStats( ctx context.Context, req *csi.NodeGetVolumeStatsRequest, ) (*csi.NodeGetVolumeStatsResponse, error)
func (*Driver) NodePublishVolume ¶
func (d *Driver) NodePublishVolume( ctx context.Context, req *csi.NodePublishVolumeRequest, ) (*csi.NodePublishVolumeResponse, error)
TODO: see the wonderful mandated error codes table covering NodePublishVolume return value semantics... (NOT currently implemented that way!)
func (*Driver) NodeStageVolume ¶
func (d *Driver) NodeStageVolume( ctx context.Context, req *csi.NodeStageVolumeRequest, ) (*csi.NodeStageVolumeResponse, error)
NodeStageVolume obtains the necessary NVMe-oF target(s) endpoints from the LB mgmt API server(s) specified in `NodeStageVolumeRequest.volume_id`, then establishes data plane connections to them to attach the volume to the node. it will also format the volume with a specified FS, if necessary, or try to recover the FS (q.v. fsck) if an existing one is detected.
func (*Driver) NodeUnpublishVolume ¶
func (d *Driver) NodeUnpublishVolume( _ context.Context, req *csi.NodeUnpublishVolumeRequest, ) (*csi.NodeUnpublishVolumeResponse, error)
func (*Driver) NodeUnstageVolume ¶
func (d *Driver) NodeUnstageVolume( ctx context.Context, req *csi.NodeUnstageVolumeRequest, ) (*csi.NodeUnstageVolumeResponse, error)
func (*Driver) Probe ¶
func (d *Driver) Probe( _ context.Context, _ *csi.ProbeRequest, ) (*csi.ProbeResponse, error)
func (*Driver) PutLBClient ¶
PutLBClient returns a client that necessarily must have been previously obtained using GetLBClient, with the understanding that the Driver will dispose of it as necessary at its discretion.
func (*Driver) ValidateVolumeCapabilities ¶
func (d *Driver) ValidateVolumeCapabilities( ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest, ) (*csi.ValidateVolumeCapabilitiesResponse, error)