attacher

package
v0.0.0-...-b40d9d8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFinalizerName

func GetFinalizerName(driver string) string

getFinalizerName returns Attacher name suitable to be used as finalizer

func GetNodeIDFromNode

func GetNodeIDFromNode(driver string, node *v1.Node) (string, error)

func GetNodeIDFromNodeInfo

func GetNodeIDFromNodeInfo(driver string, nodeInfo *csiapi.CSINodeInfo) (string, bool)

func GetVolumeAttributes

func GetVolumeAttributes(pv *v1.PersistentVolume) (map[string]string, error)

func GetVolumeCapabilities

func GetVolumeCapabilities(pv *v1.PersistentVolume) (*csi.VolumeCapability, error)

func GetVolumeHandle

func GetVolumeHandle(pv *v1.PersistentVolume) (string, bool, error)

func SanitizeDriverName

func SanitizeDriverName(driver string) string

Types

type CSIAttachController

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

func NewCSIAttachController

func NewCSIAttachController(client kubernetes.Interface, attacherName string, handler Handler, volumeAttachmentInformer storageinformers.VolumeAttachmentInformer, pvInformer coreinformers.PersistentVolumeInformer) *CSIAttachController

NewCSIAttachController returns a new *CSIAttachController

func (*CSIAttachController) Run

func (ctrl *CSIAttachController) Run(workers int, stopCh <-chan struct{})

type CSIConnection

type CSIConnection interface {
	// GetDriverName returns driver name as discovered by GetPluginInfo()
	// gRPC call.
	GetDriverName(ctx context.Context) (string, error)

	// SupportsControllerPublish returns true if the CSI driver reports
	// PUBLISH_UNPUBLISH_VOLUME in ControllerGetCapabilities() gRPC call.
	SupportsControllerPublish(ctx context.Context) (bool, error)

	// SupportsPluginControllerService return true if the CSI driver reports
	// CONTROLLER_SERVICE in GetPluginCapabilities() gRPC call.
	SupportsPluginControllerService(ctx context.Context) (bool, error)

	// Attach given volume to given node. Returns PublishVolumeInfo. Note that
	// "detached" is returned on error and means that the volume is for sure
	// detached from the node. "false" means that the volume may be either
	// detached, attaching or attached and caller should retry to get the final
	// status.
	Attach(ctx context.Context, volumeID string, readOnly bool, nodeID string, caps *csi.VolumeCapability, attributes, secrets map[string]string) (metadata map[string]string, detached bool, err error)

	// Detach given volume from given node. Note that "detached" is returned on
	// error and means that the volume is for sure detached from the node.
	// "false" means that the volume may or may not be detached and caller
	// should retry.
	Detach(ctx context.Context, volumeID string, nodeID string, secrets map[string]string) (detached bool, err error)

	// Probe checks that the CSI driver is ready to process requests
	Probe(ctx context.Context) error

	// Close the connection
	Close() error
}

CSIConnection is gRPC connection to a remote CSI driver and abstracts all CSI calls.

func New

func New(address string, timeout time.Duration) (CSIConnection, error)

type Handler

type Handler interface {
	Init(vaQueue workqueue.RateLimitingInterface, pvQueue workqueue.RateLimitingInterface)

	// SyncNewOrUpdatedVolumeAttachment processes one Add/Updated event from
	// VolumeAttachment informers. It runs in a workqueue, guaranting that only
	// one SyncNewOrUpdatedVolumeAttachment runs for given VA.
	// SyncNewOrUpdatedVolumeAttachment is responsible for marking the
	// VolumeAttachment either as forgotten (resets exponential backoff) or
	// re-queue it into the vaQueue to process it after exponential
	// backoff.
	SyncNewOrUpdatedVolumeAttachment(va *storage.VolumeAttachment)

	SyncNewOrUpdatedPersistentVolume(pv *v1.PersistentVolume)
}

Handler is responsible for handling VolumeAttachment events from informer.

func NewCSIHandler

func NewCSIHandler(
	client kubernetes.Interface,
	attacherName string,
	csiConnection CSIConnection,
	pvLister corelisters.PersistentVolumeLister,
	nodeLister corelisters.NodeLister,
	nodeInfoLister csilisters.CSINodeInfoLister,
	vaLister storagelisters.VolumeAttachmentLister,
	timeout *time.Duration) Handler

NewCSIHandler creates a new CSIHandler.

func NewTrivialHandler

func NewTrivialHandler(client kubernetes.Interface) Handler

Jump to

Keyboard shortcuts

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