kubernetes: k8s.io/kubernetes/pkg/kubelet/volumemanager/cache Index | Files

package cache

import "k8s.io/kubernetes/pkg/kubelet/volumemanager/cache"

Package cache implements data structures used by the kubelet volume manager to keep track of attached volumes and the pods that mounted them.

Package cache implements data structures used by the kubelet volume manager to keep track of attached volumes and the pods that mounted them.

Index

Package Files

actual_state_of_world.go desired_state_of_world.go

func IsFSResizeRequiredError Uses

func IsFSResizeRequiredError(err error) bool

IsFSResizeRequiredError returns true if the specified error is a fsResizeRequiredError.

func IsRemountRequiredError Uses

func IsRemountRequiredError(err error) bool

IsRemountRequiredError returns true if the specified error is a remountRequiredError.

func IsVolumeNotAttachedError Uses

func IsVolumeNotAttachedError(err error) bool

IsVolumeNotAttachedError returns true if the specified error is a volumeNotAttachedError.

type ActualStateOfWorld Uses

type ActualStateOfWorld interface {
    // ActualStateOfWorld must implement the methods required to allow
    // operationexecutor to interact with it.
    operationexecutor.ActualStateOfWorldMounterUpdater

    // ActualStateOfWorld must implement the methods required to allow
    // operationexecutor to interact with it.
    operationexecutor.ActualStateOfWorldAttacherUpdater

    // AddPodToVolume adds the given pod to the given volume in the cache
    // indicating the specified volume has been successfully mounted to the
    // specified pod.
    // If a pod with the same unique name already exists under the specified
    // volume, reset the pod's remountRequired value.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, an error is returned.
    AddPodToVolume(podName volumetypes.UniquePodName, podUID types.UID, volumeName v1.UniqueVolumeName, mounter volume.Mounter, blockVolumeMapper volume.BlockVolumeMapper, outerVolumeSpecName string, volumeGidValue string, volumeSpec *volume.Spec) error

    // MarkRemountRequired marks each volume that is successfully attached and
    // mounted for the specified pod as requiring remount (if the plugin for the
    // volume indicates it requires remounting on pod updates). Atomically
    // updating volumes depend on this to update the contents of the volume on
    // pod update.
    MarkRemountRequired(podName volumetypes.UniquePodName)

    // SetVolumeGloballyMounted sets the GloballyMounted value for the given
    // volume. When set to true this value indicates that the volume is mounted
    // to the underlying device at a global mount point. This global mount point
    // must unmounted prior to detach.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, an error is returned.
    SetVolumeGloballyMounted(volumeName v1.UniqueVolumeName, globallyMounted bool, devicePath, deviceMountPath string) error

    // DeletePodFromVolume removes the given pod from the given volume in the
    // cache indicating the volume has been successfully unmounted from the pod.
    // If a pod with the same unique name does not exist under the specified
    // volume, this is a no-op.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, an error is returned.
    DeletePodFromVolume(podName volumetypes.UniquePodName, volumeName v1.UniqueVolumeName) error

    // DeleteVolume removes the given volume from the list of attached volumes
    // in the cache indicating the volume has been successfully detached from
    // this node.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, this is a no-op.
    // If a volume with the name volumeName exists and its list of mountedPods
    // is not empty, an error is returned.
    DeleteVolume(volumeName v1.UniqueVolumeName) error

    // PodExistsInVolume returns true if the given pod exists in the list of
    // mountedPods for the given volume in the cache, indicating that the volume
    // is attached to this node and the pod has successfully mounted it.
    // If a pod with the same unique name does not exist under the specified
    // volume, false is returned.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, a volumeNotAttachedError is returned indicating the
    // given volume is not yet attached.
    // If the given volumeName/podName combo exists but the value of
    // remountRequired is true, a remountRequiredError is returned indicating
    // the given volume has been successfully mounted to this pod but should be
    // remounted to reflect changes in the referencing pod. Atomically updating
    // volumes, depend on this to update the contents of the volume.
    // All volume mounting calls should be idempotent so a second mount call for
    // volumes that do not need to update contents should not fail.
    PodExistsInVolume(podName volumetypes.UniquePodName, volumeName v1.UniqueVolumeName) (bool, string, error)

    // VolumeExistsWithSpecName returns true if the given volume specified with the
    // volume spec name (a.k.a., InnerVolumeSpecName) exists in the list of
    // volumes that should be attached to this node.
    // If a pod with the same name does not exist under the specified
    // volume, false is returned.
    VolumeExistsWithSpecName(podName volumetypes.UniquePodName, volumeSpecName string) bool

    // VolumeExists returns true if the given volume exists in the list of
    // attached volumes in the cache, indicating the volume is attached to this
    // node.
    VolumeExists(volumeName v1.UniqueVolumeName) bool

    // GetMountedVolumes generates and returns a list of volumes and the pods
    // they are successfully attached and mounted for based on the current
    // actual state of the world.
    GetMountedVolumes() []MountedVolume

    // GetMountedVolumesForPod generates and returns a list of volumes that are
    // successfully attached and mounted for the specified pod based on the
    // current actual state of the world.
    GetMountedVolumesForPod(podName volumetypes.UniquePodName) []MountedVolume

    // GetGloballyMountedVolumes generates and returns a list of all attached
    // volumes that are globally mounted. This list can be used to determine
    // which volumes should be reported as "in use" in the node's VolumesInUse
    // status field. Globally mounted here refers to the shared plugin mount
    // point for the attachable volume from which the pod specific mount points
    // are created (via bind mount).
    GetGloballyMountedVolumes() []AttachedVolume

    // GetUnmountedVolumes generates and returns a list of attached volumes that
    // have no mountedPods. This list can be used to determine which volumes are
    // no longer referenced and may be globally unmounted and detached.
    GetUnmountedVolumes() []AttachedVolume

    // MarkFSResizeRequired marks each volume that is successfully attached and
    // mounted for the specified pod as requiring file system resize (if the plugin for the
    // volume indicates it requires file system resize).
    MarkFSResizeRequired(volumeName v1.UniqueVolumeName, podName volumetypes.UniquePodName)

    // GetAttachedVolumes returns a list of volumes that is known to be attached
    // to the node. This list can be used to determine volumes that are either in-use
    // or have a mount/unmount operation pending.
    GetAttachedVolumes() []AttachedVolume
}

ActualStateOfWorld defines a set of thread-safe operations for the kubelet volume manager's actual state of the world cache. This cache contains volumes->pods i.e. a set of all volumes attached to this node and the pods that the manager believes have successfully mounted the volume. Note: This is distinct from the ActualStateOfWorld implemented by the attach/detach controller. They both keep track of different objects. This contains kubelet volume manager specific state.

func NewActualStateOfWorld Uses

func NewActualStateOfWorld(
    nodeName types.NodeName,
    volumePluginMgr *volume.VolumePluginMgr) ActualStateOfWorld

NewActualStateOfWorld returns a new instance of ActualStateOfWorld.

type AttachedVolume Uses

type AttachedVolume struct {
    operationexecutor.AttachedVolume

    // GloballyMounted indicates that the volume is mounted to the underlying
    // device at a global mount point. This global mount point must unmounted
    // prior to detach.
    GloballyMounted bool
}

AttachedVolume represents a volume that is attached to a node.

type DesiredStateOfWorld Uses

type DesiredStateOfWorld interface {
    // AddPodToVolume adds the given pod to the given volume in the cache
    // indicating the specified pod should mount the specified volume.
    // A unique volumeName is generated from the volumeSpec and returned on
    // success.
    // If no volume plugin can support the given volumeSpec or more than one
    // plugin can support it, an error is returned.
    // If a volume with the name volumeName does not exist in the list of
    // volumes that should be attached to this node, the volume is implicitly
    // added.
    // If a pod with the same unique name already exists under the specified
    // volume, this is a no-op.
    AddPodToVolume(podName types.UniquePodName, pod *v1.Pod, volumeSpec *volume.Spec, outerVolumeSpecName string, volumeGidValue string) (v1.UniqueVolumeName, error)

    // MarkVolumesReportedInUse sets the ReportedInUse value to true for the
    // reportedVolumes. For volumes not in the reportedVolumes list, the
    // ReportedInUse value is reset to false. The default ReportedInUse value
    // for a newly created volume is false.
    // When set to true this value indicates that the volume was successfully
    // added to the VolumesInUse field in the node's status. Mount operation needs
    // to check this value before issuing the operation.
    // If a volume in the reportedVolumes list does not exist in the list of
    // volumes that should be attached to this node, it is skipped without error.
    MarkVolumesReportedInUse(reportedVolumes []v1.UniqueVolumeName)

    // DeletePodFromVolume removes the given pod from the given volume in the
    // cache indicating the specified pod no longer requires the specified
    // volume.
    // If a pod with the same unique name does not exist under the specified
    // volume, this is a no-op.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, this is a no-op.
    // If after deleting the pod, the specified volume contains no other child
    // pods, the volume is also deleted.
    DeletePodFromVolume(podName types.UniquePodName, volumeName v1.UniqueVolumeName)

    // VolumeExists returns true if the given volume exists in the list of
    // volumes that should be attached to this node.
    // If a pod with the same unique name does not exist under the specified
    // volume, false is returned.
    VolumeExists(volumeName v1.UniqueVolumeName) bool

    // PodExistsInVolume returns true if the given pod exists in the list of
    // podsToMount for the given volume in the cache.
    // If a pod with the same unique name does not exist under the specified
    // volume, false is returned.
    // If a volume with the name volumeName does not exist in the list of
    // attached volumes, false is returned.
    PodExistsInVolume(podName types.UniquePodName, volumeName v1.UniqueVolumeName) bool

    // GetVolumesToMount generates and returns a list of volumes that should be
    // attached to this node and the pods they should be mounted to based on the
    // current desired state of the world.
    GetVolumesToMount() []VolumeToMount

    // GetPods generates and returns a map of pods in which map is indexed
    // with pod's unique name. This map can be used to determine which pod is currently
    // in desired state of world.
    GetPods() map[types.UniquePodName]bool

    // VolumeExistsWithSpecName returns true if the given volume specified with the
    // volume spec name (a.k.a., InnerVolumeSpecName) exists in the list of
    // volumes that should be attached to this node.
    // If a pod with the same name does not exist under the specified
    // volume, false is returned.
    VolumeExistsWithSpecName(podName types.UniquePodName, volumeSpecName string) bool

    // AddErrorToPod adds the given error to the given pod in the cache.
    // It will be returned by subsequent GetPodErrors().
    // Each error string is stored only once.
    AddErrorToPod(podName types.UniquePodName, err string)

    // PopPodErrors returns accumulated errors on a given pod and clears
    // them.
    PopPodErrors(podName types.UniquePodName) []string

    // GetPodsWithErrors returns names of pods that have stored errors.
    GetPodsWithErrors() []types.UniquePodName
}

DesiredStateOfWorld defines a set of thread-safe operations for the kubelet volume manager's desired state of the world cache. This cache contains volumes->pods i.e. a set of all volumes that should be attached to this node and the pods that reference them and should mount the volume. Note: This is distinct from the DesiredStateOfWorld implemented by the attach/detach controller. They both keep track of different objects. This contains kubelet volume manager specific state.

func NewDesiredStateOfWorld Uses

func NewDesiredStateOfWorld(volumePluginMgr *volume.VolumePluginMgr) DesiredStateOfWorld

NewDesiredStateOfWorld returns a new instance of DesiredStateOfWorld.

type MountedVolume Uses

type MountedVolume struct {
    operationexecutor.MountedVolume
}

MountedVolume represents a volume that has successfully been mounted to a pod.

type VolumeToMount Uses

type VolumeToMount struct {
    operationexecutor.VolumeToMount
}

VolumeToMount represents a volume that is attached to this node and needs to be mounted to PodName.

Package cache imports 14 packages (graph) and is imported by 162 packages. Updated 2019-09-17. Refresh now. Tools for package owners.