Documentation
¶
Overview ¶
Package allocation handles tracking pod resource allocations.
Index ¶
- Constants
- func IsInPlacePodLevelResourcesVerticalScalingAllowed(pod *v1.Pod) (allowed bool, msg, reason string)
- func IsInPlacePodVerticalScalingAllowed(pod *v1.Pod) (allowed bool, msg, reason string)
- func IsResizableContainer(container *v1.Container, containerType podutil.ContainerType) bool
- type Manager
Constants ¶
View Source
const ( TriggerReasonPodResized = "pod_resized" TriggerReasonPodUpdated = "pod_updated" TriggerReasonPodsAdded = "pods_added" TriggerReasonPodsRemoved = "pods_removed" )
podStatusManagerStateFile is the file name where status manager stores its state
Variables ¶
This section is empty.
Functions ¶
func IsInPlacePodVerticalScalingAllowed ¶ added in v1.34.0
func IsResizableContainer ¶ added in v1.34.0
func IsResizableContainer(container *v1.Container, containerType podutil.ContainerType) bool
Types ¶
type Manager ¶
type Manager interface {
// GetContainerResourceAllocation returns the AllocatedResources value for the container
GetContainerResourceAllocation(podUID types.UID, containerName string) (v1.ResourceRequirements, bool)
// GetPodLevelResourceAllocation returns the AllocatedResources value for the container
GetPodLevelResourceAllocation(podUID types.UID) (*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
// 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)
// HasPendingResizes returns whether there are currently any pending resizes.
HasPendingResizes() bool
// RetryPendingResizes retries all pending resizes.
RetryPendingResizes(trigger string)
}
AllocationManager tracks pod resource allocations.
func NewInMemoryManager ¶
func NewInMemoryManager(nodeConfig cm.NodeConfig, nodeAllocatableAbsolute v1.ResourceList, statusManager status.Manager, triggerPodSync func(pod *v1.Pod), getActivePods func() []*v1.Pod, getPodByUID func(types.UID) (*v1.Pod, bool), sourcesReady config.SourcesReady, recorder record.EventRecorder, ) Manager
NewInMemoryManager returns an allocation manager that doesn't persist state. For testing purposes only!
func NewManager ¶
func NewManager(checkpointDirectory string, nodeConfig cm.NodeConfig, nodeAllocatableAbsolute v1.ResourceList, statusManager status.Manager, triggerPodSync func(pod *v1.Pod), getActivePods func() []*v1.Pod, getPodByUID func(types.UID) (*v1.Pod, bool), sourcesReady config.SourcesReady, recorder record.EventRecorder, ) Manager
Click to show internal directories.
Click to hide internal directories.