driver

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultISCSITargetPrefix     = "iqn.2005-07.com.nexenta"
	DefaultFsType                = "ext4"
	DefaultISCSIPort             = "3260"
	HostGroupPrefix              = "csi"
	PathToInitiatorName          = "/host/etc/iscsi/initiatorname.iscsi"
	DefaultNumOfLunsPerTarget    = 256
	DefaultUseChapAuth           = false
	DefaultMountPointPermissions = 0750
	DefaultFindMntTimeout        = 90
	DefaultISCSITimeout          = 300
)
View Source
const DefaultSparseVolume = true
View Source
const TopologyKeyZone = "topology.kubernetes.io/zone"

Variables

View Source
var Commit string

Commit - driver last commit, to set commit set flags: go build -ldflags "-X github.com/Nexenta/nexentastor-csi-driver-block/pkg/driver.Commit=..."

View Source
var DateTime string

DateTime - driver build datetime, to set commit set flags: go build -ldflags "-X github.com/Nexenta/nexentastor-csi-driver-block/pkg/driver.DateTime=..."

View Source
var Name = "nexentastor-block-csi-driver.nexenta.com"

Name - driver name

Roles - list of the driver roles

View Source
var Version string

Version - driver version, to set version set flags: go build -ldflags "-X github.com/Nexenta/nexentastor-csi-driver-block/pkg/driver.Version=0.0.1"

Functions

This section is empty.

Types

type Args

type Args struct {
	Role     Role
	NodeID   string
	Endpoint string
	Config   *config.Config
	Log      *logrus.Entry
}

Args - params to crete new driver

type ControllerServer

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

ControllerServer - k8s csi driver controller server

func NewControllerServer

func NewControllerServer(driver *Driver) (*ControllerServer, error)

NewControllerServer - create an instance of controller service

func (*ControllerServer) ControllerExpandVolume

func (*ControllerServer) ControllerGetCapabilities

ControllerGetCapabilities - controller capabilities

func (*ControllerServer) ControllerGetVolume added in v1.4.11

func (*ControllerServer) ControllerPublishVolume

func (*ControllerServer) ControllerUnpublishVolume

func (*ControllerServer) CreateSnapshot

CreateSnapshot creates a snapshot of given volume

func (*ControllerServer) CreateSnapshotOnNS added in v1.0.0

func (s *ControllerServer) CreateSnapshotOnNS(nsProvider ns.ProviderInterface, volumePath, snapName string) (
	snapshot ns.Snapshot, err error)

func (*ControllerServer) CreateVolume

func (s *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (
	res *csi.CreateVolumeResponse,
	err error,
)

CreateVolume - creates volume on NexentaStor

func (*ControllerServer) DeleteSnapshot

DeleteSnapshot deletes snapshots

func (*ControllerServer) DeleteVolume

DeleteVolume - destroys volume on NexentaStor

func (*ControllerServer) GetCapacity

func (*ControllerServer) ListSnapshots

ListSnapshots returns the list of snapshots

func (*ControllerServer) ListVolumes

ListVolumes - list volumes, shows only volumes created in defaultvolumeGroup

func (*ControllerServer) ValidateVolumeCapabilities

ValidateVolumeCapabilities validates volume capabilities Shall return confirmed only if all the volume capabilities specified in the request are supported.

type CreateMappingParams added in v1.0.0

type CreateMappingParams struct {
	TargetGroup string
	VolumePath  string
	HostGroup   string
}

type Driver

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

Driver - K8s CSI driver for NexentaStor

func NewDriver

func NewDriver(args Args) (*Driver, error)

NewDriver - new driver instance

func (*Driver) Run

func (d *Driver) Run() error

Run - run the driver

func (*Driver) Validate

func (d *Driver) Validate() error

Validate - validate driver configuration: - check NS connection - check NS license - in case of cluster, check if provided addresses belong to the same cluster

type ISCSIVolumeContext added in v1.4.4

type ISCSIVolumeContext struct {
	Address            string
	Port               string
	ISCSITarget        string
	ISCSITargetPrefix  string
	TargetGroup        string
	HostGroup          string
	ChapUser           string
	ChapSecret         string
	NumOfLunsPerTarget int
	UseChapAuth        bool
	ISCSITimeout       int
}

type IdentityServer

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

IdentityServer - k8s csi driver identity server

func NewIdentityServer

func NewIdentityServer(driver *Driver) *IdentityServer

NewIdentityServer - create an instance of identity server

func (*IdentityServer) GetPluginCapabilities

GetPluginCapabilities - get plugin capabilities

func (*IdentityServer) GetPluginInfo

GetPluginInfo - return plugin info

func (*IdentityServer) Probe

Probe - return driver status (ready or not)

type NodeServer

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

NodeServer - k8s csi driver node server

func NewNodeServer

func NewNodeServer(driver *Driver) (*NodeServer, error)

NewNodeServer - create an instance of node service

func (*NodeServer) ConstructDevByPath added in v1.1.0

func (s *NodeServer) ConstructDevByPath(portal, iSCSITarget string, lunNumber int) (devByPath string)

func (*NodeServer) CreateISCSIMapping added in v1.0.0

func (s *NodeServer) CreateISCSIMapping(params CreateMappingParams, nsProvider ns.ProviderInterface) error

func (*NodeServer) CreateNewTargetTg added in v1.2.0

func (s *NodeServer) CreateNewTargetTg(parsedContext ISCSIVolumeContext, nsProvider ns.ProviderInterface) (
	target, targetGroup string,
	err error,
)

func (*NodeServer) CreateUpdateHostGroup added in v1.0.1

func (s *NodeServer) CreateUpdateHostGroup(nsProvider ns.ProviderInterface) (name string, err error)

func (*NodeServer) DeviceFromTargetPath added in v1.2.0

func (s *NodeServer) DeviceFromTargetPath(volumePath string) (deviceName string, err error)

func (*NodeServer) FlushBufs added in v1.4.8

func (s *NodeServer) FlushBufs(device string) (err error)

func (*NodeServer) GetMountPointPermissions added in v1.4.1

func (s *NodeServer) GetMountPointPermissions(volumeContext map[string]string) (os.FileMode, error)

GetMountPointPermissions - check if mountPoint persmissions were set in config or use default

func (*NodeServer) GetNodeIQN added in v1.0.1

func (s *NodeServer) GetNodeIQN() (initiatorName string, err error)

func (*NodeServer) GetRealDeviceName

func (s *NodeServer) GetRealDeviceName(symLink string) (string, error)

getRealDeviceName - get device name (e.g. /dev/sdb) from a symlink

func (*NodeServer) ISCSILogInRescan

func (s *NodeServer) ISCSILogInRescan(target, portal string) error

ISCSILogInRescan - Attempts login to iSCSI target, rescan if already logged.

func (*NodeServer) IsBlockDevice added in v1.1.0

func (s *NodeServer) IsBlockDevice(fullPath string) (bool, error)

IsBlock checks if the given path is a block device

func (*NodeServer) NodeExpandVolume

func (*NodeServer) NodeGetCapabilities

NodeGetCapabilities - get node capabilities

func (*NodeServer) NodeGetInfo

NodeGetInfo - get node info

func (*NodeServer) NodeGetVolumeStats

NodeGetVolumeStats - volume stats (available capacity)

func (*NodeServer) NodePublishVolume

NodePublishVolume - mounts NS fs to the node

func (*NodeServer) NodeStageVolume

NodeStageVolume - stage volume

func (*NodeServer) NodeUnpublishVolume

NodeUnpublishVolume - umount NS fs from the node and delete directory if successful

func (*NodeServer) NodeUnstageVolume

NodeUnstageVolume - unstage volume

func (*NodeServer) ParseVolumeContext added in v1.1.0

func (s *NodeServer) ParseVolumeContext(
	volumeContext map[string]string, nsProvider ns.ProviderInterface, configName string) (
	parsedContext ISCSIVolumeContext,
	err error,
)

func (*NodeServer) RemoveDevice

func (s *NodeServer) RemoveDevice(devName string) error

RemoveDevice - remove device (e.g. /dev/sdb) after deleting LUN

func (*NodeServer) RescanDevice added in v1.3.0

func (s *NodeServer) RescanDevice(devName string) error

func (*NodeServer) ResolveTargetGroup added in v1.2.0

func (s *NodeServer) ResolveTargetGroup(parsedContext ISCSIVolumeContext, nsProvider ns.ProviderInterface) (
	target, targetGroup string,
	err error,
)

ResolveTargetGroup - find target with lowest lunmappings or create new one

func (*NodeServer) SetChapAuth added in v1.2.0

func (s *NodeServer) SetChapAuth(name, chapUser, chapSecret string, nsProvider ns.ProviderInterface) (err error)

type ResolveNSParams

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

type ResolveNSResponse

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

type Role

type Role string

Role - role of this instance of driver

const (
	// RoleAll - run driver as both controller and node instance
	RoleAll Role = "all"

	// RoleController - run driver as a controller instance (Identity server + Controller server)
	// This role should be used with:
	// 	- "csi-provisioner" sidecar container that watches Kubernetes PersistentVolumeClaim objects
	//		and triggers CreateVolume/DeleteVolume against a CSI endpoint
	//	- "csi-attacher" sidecar container that watches Kubernetes VolumeAttachment objects
	// 		and triggers ControllerPublish/Unpublish against a CSI endpoint
	RoleController Role = "controller"

	// RoleNode - to run driver as a node instance (Identity server + Node server), runs on each K8s node
	// This role should be used with "driver-registrar", sidecar container that:
	//	1) registers the CSI driver with kubelet
	//	2) adds the drivers custom NodeId to a label on the Kubernetes Node API Object
	RoleNode Role = "node"
)

func ParseRole

func ParseRole(from string) (Role, error)

ParseRole - create role from user input

func (Role) IsController

func (r Role) IsController() bool

IsController - is this a controller role

func (Role) IsNode

func (r Role) IsNode() bool

IsNode - is this a node role

func (Role) String

func (r Role) String() string

Jump to

Keyboard shortcuts

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