Documentation ¶
Overview ¶
Package volumehelper contains consts and helper methods used by various volume components (attach/detach controller, kubelet, etc.).
Index ¶
- Constants
- func GetPersistentVolumeClaimVolumeMode(claim *v1.PersistentVolumeClaim) (v1.PersistentVolumeMode, error)
- func GetUniquePodName(pod *v1.Pod) types.UniquePodName
- func GetUniqueVolumeName(pluginName, volumeName string) v1.UniqueVolumeName
- func GetUniqueVolumeNameForNonAttachableVolume(podName types.UniquePodName, volumePlugin volume.VolumePlugin, ...) v1.UniqueVolumeName
- func GetUniqueVolumeNameFromSpec(volumePlugin volume.VolumePlugin, volumeSpec *volume.Spec) (v1.UniqueVolumeName, error)
- func GetVolumeMode(volumeSpec *volume.Spec) (v1.PersistentVolumeMode, error)
- func IsPodTerminated(pod *v1.Pod, podStatus v1.PodStatus) bool
- func NewSafeFormatAndMountFromHost(pluginName string, host volume.VolumeHost) *mount.SafeFormatAndMount
- func SplitUniqueName(uniqueName v1.UniqueVolumeName) (string, string, error)
Constants ¶
const ( // ControllerManagedAttachAnnotation is the key of the annotation on Node // objects that indicates attach/detach operations for the node should be // managed by the attach/detach controller ControllerManagedAttachAnnotation string = "volumes.kubernetes.io/controller-managed-attach-detach" // KeepTerminatedPodVolumesAnnotation is the key of the annotation on Node // that decides if pod volumes are unmounted when pod is terminated KeepTerminatedPodVolumesAnnotation string = "volumes.kubernetes.io/keep-terminated-pod-volumes" // VolumeGidAnnotationKey is the of the annotation on the PersistentVolume // object that specifies a supplemental GID. VolumeGidAnnotationKey = "pv.beta.kubernetes.io/gid" // VolumeDynamicallyCreatedByKey is the key of the annotation on PersistentVolume // object created dynamically VolumeDynamicallyCreatedByKey = "kubernetes.io/createdby" )
Variables ¶
This section is empty.
Functions ¶
func GetPersistentVolumeClaimVolumeMode ¶
func GetPersistentVolumeClaimVolumeMode(claim *v1.PersistentVolumeClaim) (v1.PersistentVolumeMode, error)
GetPersistentVolumeClaimVolumeMode retrieves VolumeMode from pvc.
func GetUniquePodName ¶
func GetUniquePodName(pod *v1.Pod) types.UniquePodName
GetUniquePodName returns a unique identifier to reference a pod by
func GetUniqueVolumeName ¶
func GetUniqueVolumeName(pluginName, volumeName string) v1.UniqueVolumeName
GetUniqueVolumeName returns a unique name representing the volume/plugin. Caller should ensure that volumeName is a name/ID uniquely identifying the actual backing device, directory, path, etc. for a particular volume. The returned name can be used to uniquely reference the volume, for example, to prevent operations (attach/detach or mount/unmount) from being triggered on the same volume.
func GetUniqueVolumeNameForNonAttachableVolume ¶
func GetUniqueVolumeNameForNonAttachableVolume( podName types.UniquePodName, volumePlugin volume.VolumePlugin, volumeSpec *volume.Spec) v1.UniqueVolumeName
GetUniqueVolumeNameForNonAttachableVolume returns the unique volume name for a non-attachable volume.
func GetUniqueVolumeNameFromSpec ¶
func GetUniqueVolumeNameFromSpec( volumePlugin volume.VolumePlugin, volumeSpec *volume.Spec) (v1.UniqueVolumeName, error)
GetUniqueVolumeNameFromSpec uses the given VolumePlugin to generate a unique name representing the volume defined in the specified volume spec. This returned name can be used to uniquely reference the actual backing device, directory, path, etc. referenced by the given volumeSpec. If the given plugin does not support the volume spec, this returns an error.
func GetVolumeMode ¶
func GetVolumeMode(volumeSpec *volume.Spec) (v1.PersistentVolumeMode, error)
GetVolumeMode retrieves VolumeMode from pv. If the volume doesn't have PersistentVolume, it's an inline volume, should return volumeMode as filesystem to keep existing behavior.
func IsPodTerminated ¶
IsPodTerminated checks if pod is terminated
func NewSafeFormatAndMountFromHost ¶
func NewSafeFormatAndMountFromHost(pluginName string, host volume.VolumeHost) *mount.SafeFormatAndMount
NewSafeFormatAndMountFromHost creates a new SafeFormatAndMount with Mounter and Exec taken from given VolumeHost.
func SplitUniqueName ¶
func SplitUniqueName(uniqueName v1.UniqueVolumeName) (string, string, error)
SplitUniqueName splits the unique name to plugin name and volume name strings. It expects the uniqueName to follow the fromat plugin_name/volume_name and the plugin name must be namespaced as descibed by the plugin interface, i.e. namespace/plugin containing exactly one '/'. This means the unique name will always be in the form of plugin_namespace/plugin/volume_name, see k8s.io/kubernetes/pkg/volume/plugins.go VolumePlugin interface description and pkg/volume/util/volumehelper/volumehelper.go GetUniqueVolumeNameFromSpec that constructs the unique volume names.
Types ¶
This section is empty.