persistentvolume

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

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.
	AnnStorageProvisioner = "volume.beta.kubernetes.io/storage-provisioner"
)

Variables

This section is empty.

Functions

func CheckAccessModes

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

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

func CheckVolumeModeMismatches

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

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

func FindMatchingVolume

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

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 GetVolumeNodeAffinity

func GetVolumeNodeAffinity(key string, value string) *v1.VolumeNodeAffinity

GetVolumeNodeAffinity returns a VolumeNodeAffinity for given key and value.

func IsDelayBindingMode

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

IsDelayBindingMode checks if claim is in delay binding mode.

func IsDelayBindingProvisioning

func IsDelayBindingProvisioning(claim *v1.PersistentVolumeClaim) bool

IsDelayBindingProvisioning checks if claim provisioning with selected-node annotation

func IsVolumeBoundToClaim

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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