volume

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 39

Documentation

Index

Constants

View Source
const (
	// AnnBindCompleted Annotation applies to PVCs. It indicates that the lifecycle
	// of the PVC has passed through the initial setup. This information changes how
	// we interpret some observations of the state of the objects. Value of this
	// Annotation does not matter.
	AnnBindCompleted = "pv.kubernetes.io/bind-completed"

	// AnnBoundByController annotation applies to PVs and PVCs. It indicates that
	// the binding (PV->PVC or PVC->PV) was installed by the controller. The
	// absence of this annotation means the binding was done by the user (i.e.
	// pre-bound). Value of this annotation does not matter.
	// External PV binders must bind PV the same way as PV controller, otherwise PV
	// controller may not handle it correctly.
	AnnBoundByController = "pv.kubernetes.io/bound-by-controller"

	// AnnSelectedNode annotation is added to a PVC that has been triggered by scheduler to
	// be dynamically provisioned. Its value is the name of the selected node.
	AnnSelectedNode = "volume.kubernetes.io/selected-node"

	// NotSupportedProvisioner is a special provisioner name which can be set
	// in storage class to indicate dynamic provisioning is not supported by
	// the storage.
	NotSupportedProvisioner = "kubernetes.io/no-provisioner"

	// AnnDynamicallyProvisioned annotation is added to a PV that has been dynamically provisioned by
	// Kubernetes. Its value is name of volume plugin that created the volume.
	// It serves both user (to show where a PV comes from) and Kubernetes (to
	// recognize dynamically provisioned PVs in its decisions).
	AnnDynamicallyProvisioned = "pv.kubernetes.io/provisioned-by"

	// AnnMigratedTo annotation is added to a PVC and PV that is supposed to be
	// dynamically provisioned/deleted by by its corresponding CSI driver
	// through the CSIMigration feature flags. When this annotation is set the
	// Kubernetes components will "stand-down" and the external-provisioner will
	// act on the objects
	AnnMigratedTo = "pv.kubernetes.io/migrated-to"

	// AnnStorageProvisioner annotation is added to a PVC that is supposed to be dynamically
	// provisioned. Its value is name of volume plugin that is supposed to provision
	// a volume for this PVC.
	// TODO: remove beta anno once deprecation period ends
	AnnStorageProvisioner     = "volume.kubernetes.io/storage-provisioner"
	AnnBetaStorageProvisioner = "volume.beta.kubernetes.io/storage-provisioner"

	//PVDeletionProtectionFinalizer is the finalizer added by the external-provisioner on the PV
	PVDeletionProtectionFinalizer = "external-provisioner.volume.kubernetes.io/finalizer"

	// PVDeletionInTreeProtectionFinalizer is the finalizer added to protect PV deletion for in-tree volumes.
	PVDeletionInTreeProtectionFinalizer = "kubernetes.io/pv-controller"
)

Variables

This section is empty.

Functions

func CheckAccessModes added in v0.24.0

func CheckAccessModes(claim *v1.PersistentVolumeClaim, volume *v1.PersistentVolume) bool

CheckAccessModes returns true if PV satisfies all the PVC's requested AccessModes

func CheckNodeAffinity added in v0.24.0

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

CheckNodeAffinity looks at the PV node affinity, and checks if the node has the same corresponding labels This ensures that we don't mount a volume that doesn't belong to this node

func CheckVolumeModeMismatches added in v0.24.0

func CheckVolumeModeMismatches(pvcSpec *v1.PersistentVolumeClaimSpec, pvSpec *v1.PersistentVolumeSpec) bool

CheckVolumeModeMismatches is a convenience method that checks volumeMode for PersistentVolume and PersistentVolumeClaims

func FindMatchingVolume added in v0.24.0

func FindMatchingVolume(
	claim *v1.PersistentVolumeClaim,
	volumes []*v1.PersistentVolume,
	node *v1.Node,
	excludedVolumes map[string]*v1.PersistentVolume,
	delayBinding bool) (*v1.PersistentVolume, error)

FindMatchingVolume goes through the list of volumes to find the best matching volume for the claim.

This function is used by both the PV controller and scheduler.

delayBinding is true only in the PV controller path. When set, prebound PVs are still returned as a match for the claim, but unbound PVs are skipped.

node is set only in the scheduler path. When set, the PV node affinity is checked against the node's labels.

excludedVolumes is only used in the scheduler path, and is needed for evaluating multiple unbound PVCs for a single Pod at one time. As each PVC finds a matching PV, the chosen PV needs to be excluded from future matching.

func GetBindVolumeToClaim added in v0.24.0

func GetBindVolumeToClaim(volume *v1.PersistentVolume, claim *v1.PersistentVolumeClaim) (*v1.PersistentVolume, bool, error)

GetBindVolumeToClaim returns a new volume which is bound to given claim. In addition, it returns a bool which indicates whether we made modification on original volume.

func GetPersistentVolumeClaimClass

func GetPersistentVolumeClaimClass(claim *v1.PersistentVolumeClaim) string

GetPersistentVolumeClaimClass returns StorageClassName. If no storage class was requested, it returns "".

func GetPersistentVolumeClass

func GetPersistentVolumeClass(volume *v1.PersistentVolume) string

GetPersistentVolumeClass returns StorageClassName.

func IsDelayBindingMode added in v0.24.0

func IsDelayBindingMode(claim *v1.PersistentVolumeClaim, classLister storagelisters.StorageClassLister) (bool, error)

IsDelayBindingMode checks if claim is in delay binding mode.

func IsDelayBindingProvisioning added in v0.24.0

func IsDelayBindingProvisioning(claim *v1.PersistentVolumeClaim) bool

IsDelayBindingProvisioning checks if claim provisioning with selected-node annotation

func IsVolumeBoundToClaim added in v0.24.0

func IsVolumeBoundToClaim(volume *v1.PersistentVolume, claim *v1.PersistentVolumeClaim) bool

IsVolumeBoundToClaim returns true, if given volume is pre-bound or bound to specific claim. Both claim.Name and claim.Namespace must be equal. If claim.UID is present in volume.Spec.ClaimRef, it must be equal too.

func PersistentVolumeClaimHasClass added in v0.26.14

func PersistentVolumeClaimHasClass(claim *v1.PersistentVolumeClaim) bool

PersistentVolumeClaimHasClass returns true if given claim has set StorageClassName field.

Types

This section is empty.

Jump to

Keyboard shortcuts

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