csipv

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	VolumeAnnotation        = "csi-volume-name"
	LeakProtectionFinalizer = "csi-leak-protection"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LeakProtectionController

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

LeakProtectionController gracefully cleans up any orphan volume created by csi plugin before external provisioner creates pv for given pvc. See https://github.com/kubernetes-csi/external-provisioner/issues/486 for more details. Note: As a storage vendor, you should be able to lookup your volumes uniquely based on csi CreateVolume request name parameter.

func NewLeakProtectionController

func NewLeakProtectionController(
	client clientset.Interface,
	pvcInformer coreinformers.PersistentVolumeClaimInformer,
	driverName string,
	onPVCDelete func(pvc *corev1.PersistentVolumeClaim, createVolumeName string) error,
) (*LeakProtectionController, error)

func (*LeakProtectionController) BeginCreateVolume

func (c *LeakProtectionController) BeginCreateVolume(volumeName,
	pvcNamespace, pvcName string) (func(), error)

BeginCreateVolume add relevant finalizer to the given pvc to avoid potential csi volume leak. It must be called from the create volume csi method implementation just before actual volume provisioning. volumeName param should be same as csi.CreateVolumeRequest Name parameter. In case of error, the csi driver should return non-retryable grpc error codes to external provisioner. Returned finishCreateVolume function must be called (preferably under defer) after attempting to provision volume. e.g

{
		finishCreateVolume, err := c.BeginCreateVolume("volumeId", "namespace", "name")
		if err != nil {
			return nil, status.Errorf(codes.FailedPrecondition, err.Error())
		}
		defer finishCreateVolume()
		..... start provisioning volume here .....
}

func (*LeakProtectionController) GetAnnotationKey

func (c *LeakProtectionController) GetAnnotationKey() string

func (*LeakProtectionController) GetFinalizer

func (c *LeakProtectionController) GetFinalizer() string

func (*LeakProtectionController) Run

func (c *LeakProtectionController) Run(workers int, stopCh <-chan struct{})

Run runs the controller goroutines.

Jump to

Keyboard shortcuts

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