controller

package
v0.0.0-...-0eb2fac Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResyncPeriodOfCsiNodeInformer = 1 * time.Hour
)

Variables

This section is empty.

Functions

func Connect

func Connect(address string, metricsManager metrics.CSIMetricsManager) (*grpc.ClientConn, error)

func GenerateAccessibilityRequirements

func GenerateAccessibilityRequirements(
	kubeClient kubernetes.Interface,
	driverName string,
	pvcName string,
	allowedTopologies []v1.TopologySelectorTerm,
	selectedNode *v1.Node,
	strictTopology bool,
	immediateTopology bool,
	csiNodeLister storagelistersv1.CSINodeLister,
	nodeLister corelisters.NodeLister) (*csi.TopologyRequirement, error)

GenerateAccessibilityRequirements returns the CSI TopologyRequirement to pass into the CSI CreateVolume request.

This function is called if the topology feature is enabled in the external-provisioner and the CSI driver implements the CSI accessibility capability. It is disabled by default.

If enabled, we require that the K8s API server is on at least K8s 1.17 and that the K8s Nodes are on at least K8s 1.15 in accordance with the 2 version skew between control plane and nodes.

There are two main cases to consider:

1) selectedNode is not set (immediate binding):

In this case, we list all CSINode objects to find a Node that
the driver has registered topology keys with.

Once we get the list of CSINode objects, we find one that has
topology keys registered. If none are found, then we assume
that the driver has not started on any node yet, and we error
and retry.

If at least one CSINode object is found with topology keys,
then we continue and use that for assembling the topology
requirement. The available topologies will be limited to the
Nodes that the driver has registered with.

2) selectedNode is set (delayed binding):

We will get the topology from the CSINode object for the selectedNode
and error if we can't (and retry).

func GenerateVolumeNodeAffinity

func GenerateVolumeNodeAffinity(accessibleTopology []*csi.Topology) *v1.VolumeNodeAffinity

func GetDriverName

func GetDriverName(conn *grpc.ClientConn, timeout time.Duration) (string, error)

func GetNodeInfo

func GetNodeInfo(conn *grpc.ClientConn, timeout time.Duration) (*csi.NodeGetInfoResponse, error)

func NewCSIProvisioner

func NewCSIProvisioner(client kubernetes.Interface,
	connectionTimeout time.Duration,
	identity string,
	volumeNamePrefix string,
	volumeNameUUIDLength int,
	grpcClient *grpc.ClientConn,
	snapshotClient snapclientset.Interface,
	driverName string,
	pluginCapabilities rpc.PluginCapabilitySet,
	controllerCapabilities rpc.ControllerCapabilitySet,
	supportsMigrationFromInTreePluginName string,
	strictTopology bool,
	immediateTopology bool,
	translator ProvisionerCSITranslator,
	scLister storagelistersv1.StorageClassLister,
	csiNodeLister storagelistersv1.CSINodeLister,
	nodeLister corelisters.NodeLister,
	claimLister corelisters.PersistentVolumeClaimLister,
	vaLister storagelistersv1.VolumeAttachmentLister,
	extraCreateMetadata bool,
	defaultFSType string,
	nodeDeployment *NodeDeployment,
	controllerPublishReadOnly bool,
	preventVolumeModeConversion bool,
) controller.Provisioner

NewCSIProvisioner creates new CSI provisioner.

vaLister is optional and only needed when VolumeAttachments are meant to be checked before deleting a volume.

func Probe

func Probe(conn *grpc.ClientConn, singleCallTimeout time.Duration) error

func SupportsTopology

func SupportsTopology(pluginCapabilities rpc.PluginCapabilitySet) bool

SupportsTopology returns whether topology is supported both for plugin and external provisioner

func VolumeIsAccessible

func VolumeIsAccessible(affinity *v1.VolumeNodeAffinity, nodeTopology *csi.Topology) (bool, error)

VolumeIsAccessible checks whether the generated volume affinity is satisfied by a the node topology that a CSI driver reported in GetNodeInfoResponse.

Types

type CloningProtectionController

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

CloningProtectionController is storing all related interfaces to handle cloning protection finalizer removal after CSI cloning is finished

func NewCloningProtectionController

func NewCloningProtectionController(
	client kubernetes.Interface,
	claimLister corelisters.PersistentVolumeClaimLister,
	claimInformer cache.SharedInformer,
	claimQueue workqueue.RateLimitingInterface,
	controllerCapabilities rpc.ControllerCapabilitySet,
) *CloningProtectionController

NewCloningProtectionController creates new controller for additional CSI claim protection capabilities

func (*CloningProtectionController) Run

func (p *CloningProtectionController) Run(ctx context.Context, threadiness int)

Run is a main CloningProtectionController handler

type NodeDeployment

type NodeDeployment struct {
	// NodeName is the name of the node in Kubernetes on which the external-provisioner runs.
	NodeName string
	// ClaimInformer is needed to detect when some other external-provisioner
	// became the owner of a PVC while the local one is still waiting before
	// trying to become the owner itself.
	ClaimInformer coreinformers.PersistentVolumeClaimInformer
	// NodeInfo is the result of NodeGetInfo. It is need to determine which
	// PVs were created for the node.
	NodeInfo csi.NodeGetInfoResponse
	// ImmediateBinding enables support for PVCs with immediate binding.
	ImmediateBinding bool
	// BaseDelay is the initial time that the external-provisioner waits
	// before trying to become the owner of a PVC with immediate binding.
	BaseDelay time.Duration
	// MaxDelay is the maximum for the initial wait time.
	MaxDelay time.Duration
}

NodeDeployment contains additional parameters for running external-provisioner alongside a CSI driver on one or more nodes in the cluster.

type ProvisionerCSITranslator

type ProvisionerCSITranslator interface {
	TranslateInTreeStorageClassToCSI(inTreePluginName string, sc *storagev1.StorageClass) (*storagev1.StorageClass, error)
	TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
	IsPVMigratable(pv *v1.PersistentVolume) bool
	TranslateInTreePVToCSI(pv *v1.PersistentVolume) (*v1.PersistentVolume, error)

	IsMigratedCSIDriverByName(csiPluginName string) bool
	GetInTreeNameFromCSIName(pluginName string) (string, error)
}

ProvisionerCSITranslator contains the set of CSI Translation functionality required by the provisioner

Jump to

Keyboard shortcuts

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