driver

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VolumeMaxRetries maximum number of times to retry until giving up on a volume create request
	VolumeMaxRetries = 10
	// VolumeRetryInterval retry interval in seconds between retries to check if a volume create request is ready
	VolumeRetryInterval = 1 // in seconds
	// AttachMaxRetries maximum number of times to retry until giving up on a volume attach request
	AttachMaxRetries = 5
	// AttachRetryInterval retry interval in seconds between retries to check if a volume attachment is ready
	AttachRetryInterval = 1 // in seconds
	// DetachMaxRetries maximum number of times to retry until giving up on a volume detach request
	DetachMaxRetries = 30
	// AttachRetryInterval retry interval in seconds between retries to check if a volume is detached
	DetachRetryInterval = 2 // in seconds
)
View Source
const (
	DriverName = "net.packet.csi"
)

Variables

This section is empty.

Functions

func ParseEndpoint

func ParseEndpoint(ep string) (string, string, error)

ParseEndpoint parse an endpoint into its parts of protocol and address

Types

type Attacher added in v1.0.0

type Attacher interface {

	// Discover also sets up the iface, so it requires the initiator
	Discover(ip, initiator string) error
	HasSession(ip, targe string) (bool, error)
	Login(ip, target string) error
	Logout(ip, target string) error
	// these check locally on the local host
	GetScsiID(devicePath string) (string, error)
	GetDevice(portal, target string) (string, error)
	// these do multipath
	MultipathReadBindings() (map[string]string, map[string]string, error)
	MultipathWriteBindings(map[string]string) error
}

IscsiAdm interface provides methods of executing iscsi admin commands

type AttacherImpl added in v1.0.0

type AttacherImpl struct {
}

func (*AttacherImpl) Discover added in v1.0.0

func (i *AttacherImpl) Discover(ip, initiator string) error

func (*AttacherImpl) GetDevice added in v1.0.0

func (i *AttacherImpl) GetDevice(portal, target string) (string, error)

look for file that matches portal, target, look up what it links to

func (*AttacherImpl) GetScsiID added in v1.0.0

func (i *AttacherImpl) GetScsiID(devicePath string) (string, error)

func (*AttacherImpl) HasSession added in v1.0.0

func (i *AttacherImpl) HasSession(ip, target string) (bool, error)

HasSession checks to see if the session exists, may log an extraneous error if the seesion does not exist

func (*AttacherImpl) Login added in v1.0.0

func (i *AttacherImpl) Login(ip, target string) error

func (*AttacherImpl) Logout added in v1.0.0

func (i *AttacherImpl) Logout(ip, target string) error

func (*AttacherImpl) MultipathReadBindings added in v1.0.0

func (i *AttacherImpl) MultipathReadBindings() (map[string]string, map[string]string, error)

read the bindings from /etc/multipath/bindings separating into keep/discard sets return elements map from volume name to scsi id

func (*AttacherImpl) MultipathWriteBindings added in v1.0.0

func (i *AttacherImpl) MultipathWriteBindings(bindings map[string]string) error

write the bindings to /etc/multipath/bindings

type BlockInfo added in v1.0.0

type BlockInfo struct {
	Name       string `json:"name"`
	FsType     string `json:"fstype"`
	Label      string `json:"label"`
	UUID       string `json:"uuid"`
	Mountpoint string `json:"mountpoint"`
}

represents the lsblk info

type Deviceset added in v1.0.0

type Deviceset struct {
	BlockDevices []BlockInfo `json:"blockdevices"`
}

represents the lsblk info

type Initializer added in v1.0.0

type Initializer interface {
	NodeInit(string) error
}

type InitializerImpl added in v1.0.0

type InitializerImpl struct {
}

func (*InitializerImpl) ConfigureMultipath added in v1.0.0

func (n *InitializerImpl) ConfigureMultipath() error

func (*InitializerImpl) NodeInit added in v1.0.0

func (n *InitializerImpl) NodeInit(initiatorName string) error

NodeInit does all node initialization necessary for iscsi to be configured correctly

func (*InitializerImpl) RestartServices added in v1.0.0

func (n *InitializerImpl) RestartServices() error

RestartServices should restart services, but we have no way to do that yet

func (*InitializerImpl) SetIscsiInitiator added in v1.0.0

func (n *InitializerImpl) SetIscsiInitiator(initiatorName string) error

SetIscsiInitiator sets the name of the iscsi initiator

type Mounter added in v1.0.0

type Mounter interface {
	Bindmount(string, string) error
	Unmount(string) error
	MountMappedDevice(string, string) error
	FormatMappedDevice(string) error
	GetMappedDevice(string) (BlockInfo, error)
}

type MounterImpl added in v1.0.0

type MounterImpl struct {
}

func (*MounterImpl) Bindmount added in v1.0.0

func (m *MounterImpl) Bindmount(src, target string) error

func (*MounterImpl) FormatMappedDevice added in v1.0.0

func (m *MounterImpl) FormatMappedDevice(device string) error

ext4 format

func (*MounterImpl) GetMappedDevice added in v1.0.0

func (m *MounterImpl) GetMappedDevice(device string) (BlockInfo, error)

get info

func (*MounterImpl) MountMappedDevice added in v1.0.0

func (m *MounterImpl) MountMappedDevice(device, target string) error

func (*MounterImpl) Unmount added in v1.0.0

func (m *MounterImpl) Unmount(path string) error

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()
}

NonBlockingGRPCServer Defines Non blocking GRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

NewNonBlockingGRPCServer create a new NonBlockingGRPCServer

type PacketControllerServer

type PacketControllerServer struct {
	Provider packet.VolumeProvider
}

PacketControllerServer controller server to manage CSI

func NewPacketControllerServer

func NewPacketControllerServer(provider packet.VolumeProvider) *PacketControllerServer

NewPacketControllerServer create new PacketControllerServer with the given provider

func (*PacketControllerServer) ControllerExpandVolume added in v1.0.0

ControllerExpandVolume expand a volume

func (*PacketControllerServer) ControllerGetCapabilities

ControllerGetCapabilities get capabilities of the controller

func (*PacketControllerServer) ControllerPublishVolume

ControllerPublishVolume attaches a volume to a node

func (*PacketControllerServer) ControllerUnpublishVolume

ControllerUnpublishVolume detaches a volume from a node

func (*PacketControllerServer) CreateSnapshot

CreateSnapshot snapshot a single volume

func (*PacketControllerServer) CreateVolume

CreateVolume create a volume in the given context according to https://kubernetes-csi.github.io/docs/external-provisioner.html this should return when the volume is successfully provisioned or fails csi contains no provision for returning from a volume creation *request* and then checking later thus, we must either succeed or fail before returning from this function call

func (*PacketControllerServer) DeleteSnapshot

DeleteSnapshot delete an existing snapshot

func (*PacketControllerServer) DeleteVolume

DeleteVolume delete the specific volume

func (*PacketControllerServer) GetCapacity

GetCapacity get the available capacity

func (*PacketControllerServer) ListSnapshots

ListSnapshots list known snapshots

func (*PacketControllerServer) ListVolumes

ListVolumes list known volumes

func (*PacketControllerServer) ValidateVolumeCapabilities

ValidateVolumeCapabilities validate that a given volume has the require capabilities

type PacketDriver

type PacketDriver struct {
	Logger      *log.Entry
	Attacher    Attacher
	Mounter     Mounter
	Initializer Initializer
	// contains filtered or unexported fields
}

PacketDriver driver for packet cloud

func NewPacketDriver

func NewPacketDriver(endpoint, nodeID string, config packet.Config) (*PacketDriver, error)

NewPacketDriver create a new PacketDriver

func (*PacketDriver) Run

func (d *PacketDriver) Run()

Run execute

func (*PacketDriver) Stop added in v1.0.0

func (d *PacketDriver) Stop()

Stop

type PacketIdentityServer

type PacketIdentityServer struct {
	Driver *PacketDriver
}

PacketIdentityServer represent the identity server for Packet

func NewPacketIdentityServer

func NewPacketIdentityServer(driver *PacketDriver) *PacketIdentityServer

NewPacketIdentityServer create a new PacketIdentityServer

func (*PacketIdentityServer) GetPluginCapabilities

func (packetIdentity *PacketIdentityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)

GetPluginCapabilities get capabilities of the plugin

func (*PacketIdentityServer) GetPluginInfo

func (packetIdentity *PacketIdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

GetPluginInfo get information about the plugin

func (*PacketIdentityServer) Probe

func (packetIdentity *PacketIdentityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

Probe probe the identity server

type PacketNodeServer

type PacketNodeServer struct {
	Driver         *PacketDriver
	MetadataDriver *packet.MetadataDriver
	Initialized    bool
	// contains filtered or unexported fields
}

PacketNodeServer represents a packet node

func NewPacketNodeServer

func NewPacketNodeServer(driver *PacketDriver, metadata *packet.MetadataDriver) (*PacketNodeServer, error)

NewPacketNodeServer create a new PacketNodeServer

func (*PacketNodeServer) NodeExpandVolume added in v1.0.0

NodeExpandVolume expand a volume

func (*PacketNodeServer) NodeGetCapabilities

NodeGetCapabilities get capabilities of a given node

func (*PacketNodeServer) NodeGetInfo

NodeGetInfo get info for a given node

func (*PacketNodeServer) NodeGetVolumeStats added in v1.0.0

NodeGetVolumeStats gets the usage stats of the volume

func (*PacketNodeServer) NodePublishVolume

func (nodeServer *PacketNodeServer) NodePublishVolume(ctx context.Context, in *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)

NodePublishVolume ~ mount

func (*PacketNodeServer) NodeStageVolume

func (nodeServer *PacketNodeServer) NodeStageVolume(ctx context.Context, in *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)

NodeStageVolume ~ iscisadmin, multipath, format

func (*PacketNodeServer) NodeUnpublishVolume

NodeUnpublishVolume ~ unmount

func (*PacketNodeServer) NodeUnstageVolume

func (nodeServer *PacketNodeServer) NodeUnstageVolume(ctx context.Context, in *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)

NodeUnstageVolume ~ iscisadmin, multipath

Jump to

Keyboard shortcuts

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