csi

package
v0.0.0-...-58f6e79 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: Apache-2.0 Imports: 55 Imported by: 37

Documentation

Index

Constants

View Source
const (
	Version     = "1.1"
	Provisioner = "csi.trident.netapp.io"

	// CSI supported features
	CSIBlockVolumes  controllerhelpers.Feature = "CSI_BLOCK_VOLUMES"
	ExpandCSIVolumes controllerhelpers.Feature = "EXPAND_CSI_VOLUMES"

	// Kubernetes topology labels
	K8sTopologyRegionLabel = "topology.kubernetes.io/region"
)
View Source
const (
	AttachISCSIVolumeTimeoutShort = 20 * time.Second
	AttachFCPVolumeTimeoutShort   = 20 * time.Second

	NodeStageNFSVolume   = "NodeStageNFSVolume"
	NodeStageSMBVolume   = "NodeStageSMBVolume"
	NodeUnstageNFSVolume = "NodeUnstageNFSVolume"
	NodeUnstageSMBVolume = "NodeUnstageSMBVolume"
	NodePublishNFSVolume = "NodePublishNFSVolume"
	NodePublishSMBVolume = "NodePublishSMBVolume"
	NodeUnpublishVolume  = "NodeUnpublishVolume"
)
View Source
const (
	CSIController = "controller"
	CSINode       = "node"
	CSIAllInOne   = "allInOne"
)

Variables

View Source
var (

	// NVMeNamespacesFlushRetry - Non-persistent map of Namespaces to maintain the flush errors if any.
	// During NodeUnstageVolume, Trident shall return success after specific wait time (nvmeMaxFlushWaitDuration).
	NVMeNamespacesFlushRetry = make(map[string]time.Time)
)

Functions

func InvalidTrackingFileError

func InvalidTrackingFileError(message string) error

func IsInvalidTrackingFileError

func IsInvalidTrackingFileError(err error) bool

func IsTerminalReconciliationError

func IsTerminalReconciliationError(err error) bool

func ParseEndpoint

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

func ReadAESKey

func ReadAESKey(ctx context.Context, aesKeyFile string) ([]byte, error)

func TerminalReconciliationError

func TerminalReconciliationError(message string) error

Types

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer)
	// GracefulStop Stops the service gracefully
	GracefulStop()
	// Stops the service forcefully
	Stop()
}

NonBlockingGRPCServer Defines Non blocking GRPC server interfaces

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

type Plugin

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

func NewAllInOnePlugin

func NewAllInOnePlugin(
	nodeName, endpoint, caCert, clientCert, clientKey, aesKeyFile string, orchestrator core.Orchestrator,
	controllerHelper *controllerhelpers.ControllerHelper, nodeHelper *nodehelpers.NodeHelper, unsafeDetach bool,
	iSCSISelfHealingInterval, iSCSIStaleSessionWaitTime, nvmeSelfHealingInterval time.Duration,
) (*Plugin, error)

The NewAllInOnePlugin is required to support the CSI Sanity test suite. CSI Sanity expects a single process to respond to controller, node, and identity interfaces.

func NewControllerPlugin

func NewControllerPlugin(
	nodeName, endpoint, aesKeyFile string, orchestrator core.Orchestrator, helper *controllerhelpers.ControllerHelper,
	enableForceDetach bool,
) (*Plugin, error)

func NewNodePlugin

func NewNodePlugin(
	nodeName, endpoint, caCert, clientCert, clientKey, aesKeyFile string, orchestrator core.Orchestrator,
	unsafeDetach bool, helper *nodehelpers.NodeHelper, enableForceDetach bool,
	iSCSISelfHealingInterval, iSCSIStaleSessionWaitTime, nvmeSelfHealingInterval time.Duration,
) (*Plugin, error)

func (*Plugin) Activate

func (p *Plugin) Activate() error

func (*Plugin) ControllerExpandVolume

func (p *Plugin) ControllerExpandVolume(
	ctx context.Context, req *csi.ControllerExpandVolumeRequest,
) (*csi.ControllerExpandVolumeResponse, error)

func (*Plugin) ControllerGetVolume

func (*Plugin) ControllerPublishVolume

func (*Plugin) CreateSnapshot

func (p *Plugin) CreateSnapshot(
	ctx context.Context, req *csi.CreateSnapshotRequest,
) (*csi.CreateSnapshotResponse, error)

func (*Plugin) CreateVolume

func (p *Plugin) CreateVolume(
	ctx context.Context, req *csi.CreateVolumeRequest,
) (*csi.CreateVolumeResponse, error)

func (*Plugin) Deactivate

func (p *Plugin) Deactivate() error

func (*Plugin) DeleteSnapshot

func (p *Plugin) DeleteSnapshot(
	ctx context.Context, req *csi.DeleteSnapshotRequest,
) (*csi.DeleteSnapshotResponse, error)

func (*Plugin) DeleteVolume

func (p *Plugin) DeleteVolume(
	ctx context.Context, req *csi.DeleteVolumeRequest,
) (*csi.DeleteVolumeResponse, error)

func (*Plugin) GetCapacity

func (*Plugin) GetName

func (p *Plugin) GetName() string

func (*Plugin) GetPluginCapabilities

func (p *Plugin) GetPluginCapabilities(
	ctx context.Context, req *csi.GetPluginCapabilitiesRequest,
) (*csi.GetPluginCapabilitiesResponse, error)

func (*Plugin) GetPluginInfo

func (p *Plugin) GetPluginInfo(
	ctx context.Context, req *csi.GetPluginInfoRequest,
) (*csi.GetPluginInfoResponse, error)

func (*Plugin) InitializeNodeLimiter

func (p *Plugin) InitializeNodeLimiter(ctx context.Context)

InitializeNodeLimiter initializes the sharedMapLimiter of node with various csi workflow related limiters. This function sets up limiters for different volume operations such as staging, unstaging, publishing, and unpublishing NFS and SMB volumes. Each limiter is configured with a semaphoreN to control the maximum number of concurrent operations allowed for each type of volume operation.

func (*Plugin) IsReady

func (p *Plugin) IsReady() bool

func (*Plugin) ListSnapshots

func (p *Plugin) ListSnapshots(
	ctx context.Context, req *csi.ListSnapshotsRequest,
) (*csi.ListSnapshotsResponse, error)

func (*Plugin) ListVolumes

func (p *Plugin) ListVolumes(
	ctx context.Context, req *csi.ListVolumesRequest,
) (*csi.ListVolumesResponse, error)

func (*Plugin) NodeExpandVolume

func (p *Plugin) NodeExpandVolume(
	ctx context.Context, req *csi.NodeExpandVolumeRequest,
) (*csi.NodeExpandVolumeResponse, error)

NodeExpandVolume handles volume expansion for Block (i.e. iSCSI) volumes. The CO only calls NodeExpandVolume for the Block protocol as the filesystem has to be mounted to perform the resize. This is enforced in our ControllerExpandVolume method where we return true for nodeExpansionRequired when the protocol is Block and return false when the protocol is file.

func (*Plugin) NodeGetCapabilities

func (*Plugin) NodeGetInfo

func (p *Plugin) NodeGetInfo(
	ctx context.Context, _ *csi.NodeGetInfoRequest,
) (*csi.NodeGetInfoResponse, error)

func (*Plugin) NodeGetVolumeStats

func (p *Plugin) NodeGetVolumeStats(
	ctx context.Context, req *csi.NodeGetVolumeStatsRequest,
) (*csi.NodeGetVolumeStatsResponse, error)

func (*Plugin) NodePublishVolume

func (p *Plugin) NodePublishVolume(
	ctx context.Context, req *csi.NodePublishVolumeRequest,
) (*csi.NodePublishVolumeResponse, error)

func (*Plugin) NodeStageVolume

func (p *Plugin) NodeStageVolume(
	ctx context.Context, req *csi.NodeStageVolumeRequest,
) (*csi.NodeStageVolumeResponse, error)

func (*Plugin) NodeUnpublishVolume

func (p *Plugin) NodeUnpublishVolume(
	ctx context.Context, req *csi.NodeUnpublishVolumeRequest,
) (*csi.NodeUnpublishVolumeResponse, error)

func (*Plugin) NodeUnstageVolume

func (p *Plugin) NodeUnstageVolume(
	ctx context.Context, req *csi.NodeUnstageVolumeRequest,
) (*csi.NodeUnstageVolumeResponse, error)

func (*Plugin) Probe

func (p *Plugin) Probe(
	ctx context.Context, req *csi.ProbeRequest,
) (*csi.ProbeResponse, error)

func (*Plugin) Version

func (p *Plugin) Version() string

type RequestHandler

type RequestHandler interface {
	GetVolumeId() string
	GetStagingTargetPath() string
}

type VolumePublishManager

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

func NewVolumePublishManager

func NewVolumePublishManager(volumeTrackingInfoPath string) (*VolumePublishManager, error)

func NewVolumePublishManagerDetailed

func NewVolumePublishManagerDetailed(
	volumeTrackingInfoPath string,
	fs filesystem.Filesystem,
	osFs afero.Fs,
) *VolumePublishManager

func (*VolumePublishManager) DeleteFailedUpgradeTrackingFile

func (v *VolumePublishManager) DeleteFailedUpgradeTrackingFile(ctx context.Context, file os.FileInfo)

DeleteFailedUpgradeTrackingFile deletes all tracking files whose writes were interrupted and caused a failure before the atomic write (os.Rename) happened. Deleting these failed upgrade files will not lose information, as the original files are left in place on error. Therefore, upgrades will be retried on the next reconcile loop.

func (*VolumePublishManager) DeleteTrackingInfo

func (v *VolumePublishManager) DeleteTrackingInfo(ctx context.Context, volumeID string) error

DeleteTrackingInfo deletes the tracking info staging target path info for a volume from Trident's own volume tracking location (/var/lib/trident/tracking). This method is idempotent, in that if the file doesn't exist, no error is generated.

func (*VolumePublishManager) GetVolumeTrackingFiles

func (v *VolumePublishManager) GetVolumeTrackingFiles() ([]os.FileInfo, error)

GetVolumeTrackingFiles returns all the tracking files in the tracking directory.

func (*VolumePublishManager) ListVolumeTrackingInfo

func (v *VolumePublishManager) ListVolumeTrackingInfo(ctx context.Context) (map[string]*models.VolumeTrackingInfo, error)

ListVolumeTrackingInfo returns a map of tracking files to their contents (volume tracking information).

func (*VolumePublishManager) ReadTrackingInfo

func (v *VolumePublishManager) ReadTrackingInfo(
	ctx context.Context, volumeID string,
) (*models.VolumeTrackingInfo, error)

ReadTrackingInfo reads from Trident's own volume tracking location (/var/lib/trident/tracking) and returns the staging target path, publish info and publish paths for a volume

func (*VolumePublishManager) UpgradeVolumeTrackingFile

func (v *VolumePublishManager) UpgradeVolumeTrackingFile(
	ctx context.Context, volumeId string, publishedPaths map[string]struct{}, pvToDeviceMappings map[string]string,
) (bool, error)

UpgradeVolumeTrackingFile ensures the published paths for the volume will be discovered (because we previously did not track them) and then an attempt to upgrade the volume tracking file will be made. If either the stagedDeviceInfo or legacy tracking file do not exist, or are unable to be unmarshalled, then an upgrade is not possible, and we must delete the tracking file because it no longer has any value.

func (*VolumePublishManager) ValidateTrackingFile

func (v *VolumePublishManager) ValidateTrackingFile(ctx context.Context, volumeId string) (bool, error)

ValidateTrackingFile checks whether a tracking file needs to be deleted.

func (*VolumePublishManager) WriteTrackingInfo

func (v *VolumePublishManager) WriteTrackingInfo(
	ctx context.Context, volumeID string, trackingInfo *models.VolumeTrackingInfo,
) error

WriteTrackingInfo writes the serialized staging target path, publish info and publish paths for a volume to Trident's own volume tracking location (/var/lib/trident/tracking) so that node bookkeeping is possible for features like force detach

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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