controller

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 45 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 added in v0.4.1

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

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

This function is only 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.14, and that the K8s CSINode feature gate is enabled. In order for the topology feature to fully function correctly, the K8s Nodes also have to be upgraded to 1.14 in order for kubelet to register and create the new CSINode beta objects.

However, due to K8s master/node 2 version skew support, it's possible that the Nodes have not been upgraded yet, so this feature needs to handle that skew. 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. The List() API
call should succeed because we at least require the K8s API
server to be on 1.14. If it doesn't succeed, then we error.

Once we get the list of CSINode objects, we find one that has
topology keys registered. If none are found, then we assume
that either no Nodes have been upgraded and/or the driver has
not registered any topology keys. In that case, we fallback to
"topology disabled" behavior.

If at least one CSINode object is found with topology keys,
then we continue and use that for assembling the topology
requirement. While Nodes are being upgraded, the available
topologies will be limited to the upgraded Nodes.

2) selectedNode is set (delayed binding):

This case never worked well in a multi-topology environment
without the topology feature, because we would not pass in
any topology to the driver (including any AllowedTopologies),
and the driver would choose a random topology to provision in,
often resulting in Pod scheduling failures.

So for the multi-topology environment, topology is considered
to be a new feature, and requires both K8s master and nodes to
be upgraded to 1.14 to fully function.

However, it was still possible for a K8s user to use delayed
binding if the driver was deployed in a single-topology
environment (such as a single zone), where topology could be
effectively ignored. That use case still needs to be supported
with this topology feature enabled.

With the feature enabled, now we will try to get the CSINode
object for the selectedNode.

If it doesn't exist, then we need to check the Node version.
If the Node is on a pre-1.14 version, then we fallback to
"topology disabled" behavior.

Otherwise, the node is on 1.14+ and we error because either:
  * the driver hasn't registered a topology key yet, or
  * there's some temporary API server issue.

func GenerateVolumeNodeAffinity added in v0.4.1

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

func GetDriverCapabilities added in v1.1.0

func GetDriverCapabilities(conn *grpc.ClientConn, timeout time.Duration) (rpc.PluginCapabilitySet, rpc.ControllerCapabilitySet, error)

func GetDriverName added in v1.0.0

func GetDriverName(conn *grpc.ClientConn, timeout time.Duration) (string, 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,
	translator ProvisionerCSITranslator,
	scLister storagelistersv1.StorageClassLister,
	csiNodeLister storagelistersv1beta1.CSINodeLister,
	nodeLister corelisters.NodeLister,
	claimLister corelisters.PersistentVolumeClaimLister,
	extraCreateMetadata bool,
) controller.Provisioner

NewCSIProvisioner creates new CSI provisioner

func Probe added in v1.1.0

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

func SupportsTopology added in v1.5.0

func SupportsTopology(pluginCapabilities rpc.PluginCapabilitySet) bool

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

Types

type CloningProtectionController added in v1.6.0

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 added in v1.6.0

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

NewCloningProtectionController creates new controller for additional CSI claim protection capabilities

func (*CloningProtectionController) Run added in v1.6.0

func (p *CloningProtectionController) Run(threadiness int, stopCh <-chan struct{})

Run is a main CloningProtectionController handler

type ProvisionerCSITranslator added in v1.5.0

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