node

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package node provides CSI specification compatible node service.

Index

Constants

This section is empty.

Variables

View Source
var ReachableEndPoint = common.ReachableEndPoint

ReachableEndPoint checks if the endpoint is reachable or not

Functions

func MarshalSyncMapToJSON

func MarshalSyncMapToJSON(m *sync.Map) ([]byte, error)

MarshalSyncMapToJSON marshal the sync Map to Json

Types

type FcConnector

type FcConnector interface {
	ConnectVolume(ctx context.Context, info gobrick.FCVolumeInfo) (gobrick.Device, error)
	DisconnectVolumeByDeviceName(ctx context.Context, name string) error
	GetInitiatorPorts(ctx context.Context) ([]string, error)
}

FcConnector is wrapper of gobrcik.FcConnector interface. It allows to connect FC volumes to the node.

type ISCSIConnector

type ISCSIConnector interface {
	ConnectVolume(ctx context.Context, info gobrick.ISCSIVolumeInfo) (gobrick.Device, error)
	DisconnectVolumeByDeviceName(ctx context.Context, name string) error
	GetInitiatorName(ctx context.Context) ([]string, error)
}

ISCSIConnector is wrapper of gobrcik.ISCSIConnector interface. It allows to connect iSCSI volumes to the node.

type NFSPublisher

type NFSPublisher struct{}

NFSPublisher implementation of NodeVolumePublisher for NFS volumes

func (*NFSPublisher) Publish

func (np *NFSPublisher) Publish(ctx context.Context, logFields log.Fields, fs fs.Interface,
	cap *csi.VolumeCapability, isRO bool, targetPath string, stagingPath string,
) (*csi.NodePublishVolumeResponse, error)

Publish publishes nfs volume by mounting it to the target path

type NFSStager

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

NFSStager implementation of NodeVolumeStager for NFS volumes

func (*NFSStager) Stage

Stage stages volume by mounting volumes as nfs to the staging path

type NFSv4ACLs

type NFSv4ACLs struct{}

NFSv4ACLs implements setting NFSv4 ACLs

func (*NFSv4ACLs) SetNfsv4Acls

func (n *NFSv4ACLs) SetNfsv4Acls(acls string, dir string) error

SetNfsv4Acls sets NFSv4 ACLS

type NFSv4ACLsInterface

type NFSv4ACLsInterface interface {
	// SetNfsv4Acls sets NFSv4 ACLs
	SetNfsv4Acls(acls string, dir string) error
}

NFSv4ACLsInterface contains method definition to set NFSv4 ACLs

type NVMEConnector

type NVMEConnector interface {
	ConnectVolume(ctx context.Context, info gobrick.NVMeVolumeInfo, useFC bool) (gobrick.Device, error)
	DisconnectVolumeByDeviceName(ctx context.Context, name string) error
	GetInitiatorName(ctx context.Context) ([]string, error)
}

NVMEConnector is wrapper of gobrick.NVMEConnector interface. It allows to connect NVMe volumes to the node.

type Opts

type Opts struct {
	NodeIDFilePath        string
	NodeNamePrefix        string
	NodeChrootPath        string
	MaxVolumesPerNode     int64
	FCPortsFilterFilePath string
	KubeNodeName          string
	KubeConfigPath        string
	CHAPUsername          string
	CHAPPassword          string
	TmpDir                string
	EnableCHAP            bool
}

Opts defines service configuration options.

type SCSIPublisher

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

SCSIPublisher implementation of NodeVolumePublisher for SCSI based (FC, iSCSI) volumes

func (*SCSIPublisher) Publish

func (sp *SCSIPublisher) Publish(ctx context.Context, logFields log.Fields, fs fs.Interface, cap *csi.VolumeCapability, isRO bool, targetPath string, stagingPath string) (*csi.NodePublishVolumeResponse, error)

Publish publishes volume as either raw block or mount by mounting it to the target path

type SCSIStager

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

SCSIStager implementation of NodeVolumeStager for SCSI based (FC, iSCSI) volumes

func (*SCSIStager) Stage

func (s *SCSIStager) Stage(ctx context.Context, req *csi.NodeStageVolumeRequest,
	logFields log.Fields, fs fs.Interface, id string, isRemote bool,
) (*csi.NodeStageVolumeResponse, error)

Stage stages volume by connecting it through either FC or iSCSI and creating bind mount to staging path

type Service

type Service struct {
	Fs fs.Interface

	array.Locker
	// contains filtered or unexported fields
}

Service is a controller service that contains scsi connectors and implements NodeServer API

func (*Service) Init

func (s *Service) Init() error

Init initializes node service by parsing environmental variables, connecting it as a host. Will init ISCSIConnector, FcConnector and ControllerService if they are nil.

func (*Service) NodeExpandVolume

NodeExpandVolume expands the volume by re-scanning and resizes filesystem if needed

func (*Service) NodeGetCapabilities

NodeGetCapabilities returns supported features by the node service

func (*Service) NodeGetInfo

NodeGetInfo returns id of the node and topology constraints

func (*Service) NodeGetVolumeStats

NodeGetVolumeStats returns volume usage stats

func (*Service) NodePublishVolume

NodePublishVolume publishes volume to the node by mounting it to the target path

func (*Service) NodeStageVolume

NodeStageVolume prepares volume to be consumed by node publish by connecting volume to the node

func (*Service) NodeUnpublishVolume

NodeUnpublishVolume unpublishes volume from the node by unmounting it from the target path

func (*Service) NodeUnstageVolume

NodeUnstageVolume reverses steps done in NodeStage by disconnecting volume from the node

type VolumePublisher

type VolumePublisher interface {
	Publish(ctx context.Context, logFields log.Fields, fs fs.Interface,
		cap *csi.VolumeCapability, isRO bool, targetPath string, stagingPath string) (*csi.NodePublishVolumeResponse, error)
}

VolumePublisher allows to node publish a volume

type VolumeStager

type VolumeStager interface {
	Stage(ctx context.Context, req *csi.NodeStageVolumeRequest, logFields log.Fields, fs fs.Interface, id string, isRemote bool) (*csi.NodeStageVolumeResponse, error)
}

VolumeStager allows to node stage a volume

Jump to

Keyboard shortcuts

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