package allocation
import "k8s.io/kubernetes/pkg/kubelet/allocation"
Package allocation handles tracking pod resource allocations.
Index ¶
- func IsInPlacePodVerticalScalingAllowed(_ *v1.Pod) (allowed bool, msg string)
- type Manager
- func NewInMemoryManager(containerManager cm.ContainerManager, statusManager status.Manager, triggerPodSync func(pod *v1.Pod), getActivePods func() []*v1.Pod, getPodByUID func(types.UID) (*v1.Pod, bool), sourcesReady config.SourcesReady, ) Manager
- func NewManager(checkpointDirectory string, containerManager cm.ContainerManager, statusManager status.Manager, triggerPodSync func(pod *v1.Pod), getActivePods func() []*v1.Pod, getPodByUID func(types.UID) (*v1.Pod, bool), sourcesReady config.SourcesReady, ) Manager
Functions ¶
func IsInPlacePodVerticalScalingAllowed ¶
Types ¶
type Manager ¶
type Manager interface { // GetContainerResourceAllocation returns the AllocatedResources value for the container GetContainerResourceAllocation(podUID types.UID, containerName string) (v1.ResourceRequirements, bool) // UpdatePodFromAllocation overwrites the pod spec with the allocation. // This function does a deep copy only if updates are needed. // Returns the updated (or original) pod, and whether there was an allocation stored. UpdatePodFromAllocation(pod *v1.Pod) (*v1.Pod, bool) // SetAllocatedResources checkpoints the resources allocated to a pod's containers. SetAllocatedResources(allocatedPod *v1.Pod) error // SetActuatedResources records the actuated resources of the given container (or the entire // pod, if actuatedContainer is nil). SetActuatedResources(allocatedPod *v1.Pod, actuatedContainer *v1.Container) error // GetActuatedResources returns the stored actuated resources for the container, and whether they exist. GetActuatedResources(podUID types.UID, containerName string) (v1.ResourceRequirements, bool) // AddPodAdmitHandlers adds the admit handlers to the allocation manager. // TODO: See if we can remove this and just add them in the allocation manager constructor. AddPodAdmitHandlers(handlers lifecycle.PodAdmitHandlers) // SetContainerRuntime sets the allocation manager's container runtime. // TODO: See if we can remove this and just add it in the allocation manager constructor. SetContainerRuntime(runtime kubecontainer.Runtime) // AddPod checks if a pod can be admitted. If so, it admits the pod and updates the allocation. // The function returns a boolean value indicating whether the pod // can be admitted, a brief single-word reason and a message explaining why // the pod cannot be admitted. // allocatedPods should represent the pods that have already been admitted, along with their // admitted (allocated) resources. AddPod(activePods []*v1.Pod, pod *v1.Pod) (ok bool, reason, message string) // RemovePod removes any stored state for the given pod UID. RemovePod(uid types.UID) // RemoveOrphanedPods removes the stored state for any pods not included in the set of remaining pods. RemoveOrphanedPods(remainingPods sets.Set[types.UID]) // Run starts the allocation manager. This is currently only used to handle periodic retry of // pending resizes. Run(ctx context.Context) // PushPendingResize queues a pod with a pending resize request for later reevaluation. PushPendingResize(uid types.UID) // RetryPendingResizes retries all pending resizes. It returns a list of successful resizes. RetryPendingResizes() []*v1.Pod // CheckPodResizeInProgress checks whether the actuated resizable resources differ from the allocated resources // for any running containers. CheckPodResizeInProgress(allocatedPod *v1.Pod, podStatus *kubecontainer.PodStatus) }
AllocationManager tracks pod resource allocations.
func NewInMemoryManager ¶
func NewInMemoryManager(containerManager cm.ContainerManager, statusManager status.Manager, triggerPodSync func(pod *v1.Pod), getActivePods func() []*v1.Pod, getPodByUID func(types.UID) (*v1.Pod, bool), sourcesReady config.SourcesReady, ) Manager
NewInMemoryManager returns an allocation manager that doesn't persist state. For testing purposes only!
func NewManager ¶
func NewManager(checkpointDirectory string, containerManager cm.ContainerManager, statusManager status.Manager, triggerPodSync func(pod *v1.Pod), getActivePods func() []*v1.Pod, getPodByUID func(types.UID) (*v1.Pod, bool), sourcesReady config.SourcesReady, ) Manager
Source Files ¶
allocation_manager.go doc.go features_windows.go
Directories ¶
Path | Synopsis |
---|---|
pkg/kubelet/allocation/state |
- Version
- v1.34.0-beta.0
- Published
- Jul 16, 2025
- Platform
- windows/amd64
- Imports
- 26 packages
- Last checked
- 5 minutes ago –
Tools for package owners.