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" // 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" )
CheckAccessModes returns true if PV satisfies all the PVC's requested AccessModes
func CheckVolumeModeMismatches(pvcSpec *v1.PersistentVolumeClaimSpec, pvSpec *v1.PersistentVolumeSpec) (bool, error)
CheckVolumeModeMismatches is a convenience method that checks volumeMode for PersistentVolume and PersistentVolumeClaims
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(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.
GetVolumeNodeAffinity returns a VolumeNodeAffinity for given key and value.
func IsDelayBindingMode(claim *v1.PersistentVolumeClaim, classLister storagelisters.StorageClassLister) (bool, error)
IsDelayBindingMode checks if claim is in delay binding mode.
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.