Documentation
¶
Index ¶
- Constants
- type FakeVolumeManager
- func (f *FakeVolumeManager) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64
- func (f *FakeVolumeManager) GetMountedVolumesForPod(podName types.UniquePodName) container.VolumeMap
- func (f *FakeVolumeManager) GetVolumesInUse() []v1.UniqueVolumeName
- func (f *FakeVolumeManager) GetVolumesReportedInUse() []v1.UniqueVolumeName
- func (f *FakeVolumeManager) HasPossiblyMountedVolumesForPod(podName types.UniquePodName) bool
- func (f *FakeVolumeManager) MarkVolumesAsReportedInUse(volumesReportedAsInUse []v1.UniqueVolumeName)
- func (f *FakeVolumeManager) ReconcilerStatesHasBeenSynced() bool
- func (f *FakeVolumeManager) Run(ctx context.Context, sourcesReady config.SourcesReady)
- func (f *FakeVolumeManager) VolumeIsAttached(volumeName v1.UniqueVolumeName) bool
- func (f *FakeVolumeManager) WaitForAllPodsUnmount(ctx context.Context, pods []*v1.Pod) error
- func (f *FakeVolumeManager) WaitForAttachAndMount(ctx context.Context, pod *v1.Pod) error
- func (f *FakeVolumeManager) WaitForUnmount(ctx context.Context, pod *v1.Pod) error
- type PodManager
- type PodStateProvider
- type VolumeAttachLimitExceededError
- type VolumeManager
Constants ¶
const ( // VolumeAttachmentLimitExceededReason is the reason for rejecting a pod // when the node has reached its volume attachment limit. VolumeAttachmentLimitExceededReason = "VolumeAttachmentLimitExceeded" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeVolumeManager ¶ added in v1.14.0
type FakeVolumeManager struct {
// contains filtered or unexported fields
}
FakeVolumeManager is a test implementation that just tracks calls
func NewFakeVolumeManager ¶ added in v1.14.0
func NewFakeVolumeManager(initialVolumes []v1.UniqueVolumeName, unmountDelay time.Duration, unmountError error, volumeAttachLimitExceeded bool) *FakeVolumeManager
NewFakeVolumeManager creates a new VolumeManager test instance
func (*FakeVolumeManager) GetExtraSupplementalGroupsForPod ¶ added in v1.14.0
func (f *FakeVolumeManager) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64
GetExtraSupplementalGroupsForPod is not implemented
func (*FakeVolumeManager) GetMountedVolumesForPod ¶ added in v1.14.0
func (f *FakeVolumeManager) GetMountedVolumesForPod(podName types.UniquePodName) container.VolumeMap
GetMountedVolumesForPod is not implemented
func (*FakeVolumeManager) GetVolumesInUse ¶ added in v1.14.0
func (f *FakeVolumeManager) GetVolumesInUse() []v1.UniqueVolumeName
GetVolumesInUse returns a list of the initial volumes
func (*FakeVolumeManager) GetVolumesReportedInUse ¶ added in v1.14.0
func (f *FakeVolumeManager) GetVolumesReportedInUse() []v1.UniqueVolumeName
GetVolumesReportedInUse is a test function only that returns a list of volumes from the reportedInUse map
func (*FakeVolumeManager) HasPossiblyMountedVolumesForPod ¶
func (f *FakeVolumeManager) HasPossiblyMountedVolumesForPod(podName types.UniquePodName) bool
HasPossiblyMountedVolumesForPod is not implemented
func (*FakeVolumeManager) MarkVolumesAsReportedInUse ¶ added in v1.14.0
func (f *FakeVolumeManager) MarkVolumesAsReportedInUse(volumesReportedAsInUse []v1.UniqueVolumeName)
MarkVolumesAsReportedInUse adds the given volumes to the reportedInUse map
func (*FakeVolumeManager) ReconcilerStatesHasBeenSynced ¶ added in v1.14.0
func (f *FakeVolumeManager) ReconcilerStatesHasBeenSynced() bool
ReconcilerStatesHasBeenSynced is not implemented
func (*FakeVolumeManager) Run ¶ added in v1.14.0
func (f *FakeVolumeManager) Run(ctx context.Context, sourcesReady config.SourcesReady)
Run is not implemented
func (*FakeVolumeManager) VolumeIsAttached ¶ added in v1.14.0
func (f *FakeVolumeManager) VolumeIsAttached(volumeName v1.UniqueVolumeName) bool
VolumeIsAttached is not implemented
func (*FakeVolumeManager) WaitForAllPodsUnmount ¶ added in v1.32.0
func (*FakeVolumeManager) WaitForAttachAndMount ¶ added in v1.14.0
WaitForAttachAndMount is not implemented
func (*FakeVolumeManager) WaitForUnmount ¶ added in v1.22.0
WaitForUnmount is not implemented
type PodManager ¶ added in v1.28.0
PodManager is the subset of methods the manager needs to observe the actual state of the kubelet. See pkg/k8s.io/kubernetes/pkg/kubelet/pod.Manager for method godoc.
type PodStateProvider ¶ added in v1.28.0
type PodStateProvider interface {
ShouldPodContainersBeTerminating(k8stypes.UID) bool
ShouldPodRuntimeBeRemoved(k8stypes.UID) bool
}
podStateProvider can determine if a pod is going to be terminated
type VolumeAttachLimitExceededError ¶ added in v1.34.0
type VolumeAttachLimitExceededError struct {
UnmountedVolumes []string
UnattachedVolumes []string
VolumesNotInDSW []string
OriginalError error
}
func (*VolumeAttachLimitExceededError) Error ¶ added in v1.34.0
func (e *VolumeAttachLimitExceededError) Error() string
type VolumeManager ¶
type VolumeManager interface {
// Starts the volume manager and all the asynchronous loops that it controls
Run(ctx context.Context, sourcesReady config.SourcesReady)
// WaitForAttachAndMount processes the volumes referenced in the specified
// pod and blocks until they are all attached and mounted (reflected in
// actual state of the world).
// An error is returned if all volumes are not attached and mounted within
// the duration defined in podAttachAndMountTimeout.
WaitForAttachAndMount(ctx context.Context, pod *v1.Pod) error
// WaitForUnmount processes the volumes referenced in the specified
// pod and blocks until they are all unmounted (reflected in the actual
// state of the world).
// An error is returned if all volumes are not unmounted within
// the duration defined in podAttachAndMountTimeout.
WaitForUnmount(ctx context.Context, pod *v1.Pod) error
// WaitForAllPodsUnmount is a version of WaitForUnmount that blocks and
// waits until all the volumes belonging to all the pods are unmounted.
// An error is returned if there's at least one Pod with volumes not unmounted
// within the duration defined in podAttachAndMountTimeout.
WaitForAllPodsUnmount(ctx context.Context, pods []*v1.Pod) error
// GetMountedVolumesForPod returns a VolumeMap containing the volumes
// referenced by the specified pod that are desired and actually attached and
// mounted. The key in the map is the OuterVolumeSpecName (i.e.
// pod.Spec.Volumes[x].Name). It returns an empty VolumeMap if pod has no
// volumes.
GetMountedVolumesForPod(podName types.UniquePodName) container.VolumeMap
// HasPossiblyMountedVolumesForPod returns whether the pod has
// any volumes that are either successfully attached
// and mounted or are "uncertain", i.e. a volume plugin may be mounting
// them right now.
HasPossiblyMountedVolumesForPod(podName types.UniquePodName) bool
// GetExtraSupplementalGroupsForPod returns a list of the extra
// supplemental groups for the Pod. These extra supplemental groups come
// from annotations on persistent volumes that the pod depends on.
GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64
// GetVolumesInUse returns a list of all volumes that implement the volume.Attacher
// interface and are currently in use according to the actual and desired
// state of the world caches. A volume is considered "in use" as soon as it
// is added to the desired state of world, indicating it *should* be
// attached to this node and remains "in use" until it is removed from both
// the desired state of the world and the actual state of the world, or it
// has been unmounted (as indicated in actual state of world).
GetVolumesInUse() []v1.UniqueVolumeName
// ReconcilerStatesHasBeenSynced returns true only after the actual states in reconciler
// has been synced at least once after kubelet starts so that it is safe to update mounted
// volume list retrieved from actual state.
ReconcilerStatesHasBeenSynced() bool
// VolumeIsAttached returns true if the given volume is attached to this
// node.
VolumeIsAttached(volumeName v1.UniqueVolumeName) bool
// Marks the specified volume as having successfully been reported as "in
// use" in the nodes's volume status.
MarkVolumesAsReportedInUse(volumesReportedAsInUse []v1.UniqueVolumeName)
}
VolumeManager runs a set of asynchronous loops that figure out which volumes need to be attached/mounted/unmounted/detached based on the pods scheduled on this node and makes it so.
func NewVolumeManager ¶
func NewVolumeManager( controllerAttachDetachEnabled bool, nodeName k8stypes.NodeName, podManager PodManager, podStateProvider PodStateProvider, kubeClient clientset.Interface, volumePluginMgr *volume.VolumePluginMgr, mounter mount.Interface, hostutil hostutil.HostUtils, kubeletPodsDir string, recorder record.EventRecorder, blockVolumePathHandler volumepathhandler.BlockVolumePathHandler) VolumeManager
NewVolumeManager returns a new concrete instance implementing the VolumeManager interface.
kubeClient - kubeClient is the kube API client used by DesiredStateOfWorldPopulator to communicate with the API server to fetch PV and PVC objects
volumePluginMgr - the volume plugin manager used to access volume plugins. Must be pre-initialized.
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |
|
Package populator implements interfaces that monitor and keep the states of the caches in sync with the "ground truth".
|
Package populator implements interfaces that monitor and keep the states of the caches in sync with the "ground truth". |