kubernetesk8s.io/kubernetes/pkg/kubelet/allocation Index | Files | Directories

package allocation

import "k8s.io/kubernetes/pkg/kubelet/allocation"

Package allocation handles tracking pod resource allocations.

Index

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)

	// 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])
}

AllocationManager tracks pod resource allocations.

func NewInMemoryManager

func NewInMemoryManager() Manager

NewInMemoryManager returns an allocation manager that doesn't persist state. For testing purposes only!

func NewManager

func NewManager(checkpointDirectory string) Manager

Source Files

allocation_manager.go doc.go

Directories

PathSynopsis
pkg/kubelet/allocation/state
Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
3 hours ago

Tools for package owners.