package memorymanager
import "k8s.io/kubernetes/pkg/kubelet/cm/memorymanager"
Index ¶
- Constants
- type ActivePodsFunc
- type Manager
- func NewFakeManager(ctx context.Context) Manager
- func NewManager(ctx context.Context, policyName string, machineInfo *cadvisorapi.MachineInfo, nodeAllocatableReservation v1.ResourceList, reservedMemory []kubeletconfig.MemoryReservation, stateFileDirectory string, affinity topologymanager.Store) (Manager, error)
- type Policy
- func NewPolicyBestEffort(ctx context.Context, machineInfo *cadvisorapi.MachineInfo, reserved systemReservedMemory, affinity topologymanager.Store) (Policy, error)
- func NewPolicyNone(ctx context.Context) Policy
- func NewPolicyStatic(ctx context.Context, machineInfo *cadvisorapi.MachineInfo, reserved systemReservedMemory, affinity topologymanager.Store) (Policy, error)
Constants ¶
const PolicyTypeStatic policyType = "Static"
Types ¶
type ActivePodsFunc ¶
ActivePodsFunc is a function that returns a list of active pods
type Manager ¶
type Manager interface { // Start is called during Kubelet initialization. Start(ctx context.Context, activePods ActivePodsFunc, sourcesReady config.SourcesReady, podStatusProvider status.PodStatusProvider, containerRuntime runtimeService, initialContainers containermap.ContainerMap) error // AddContainer adds the mapping between container ID to pod UID and the container name // The mapping used to remove the memory allocation during the container removal AddContainer(ctx context.Context, p *v1.Pod, c *v1.Container, containerID string) // Allocate is called to pre-allocate memory resources during Pod admission. // This must be called at some point prior to the AddContainer() call for a container, e.g. at pod admission time. Allocate(pod *v1.Pod, container *v1.Container) error // RemoveContainer is called after Kubelet decides to kill or delete a // container. After this call, any memory allocated to the container is freed. RemoveContainer(ctx context.Context, containerID string) error // State returns a read-only interface to the internal memory manager state. State() state.Reader // GetTopologyHints implements the topologymanager.HintProvider Interface // and is consulted to achieve NUMA aware resource alignment among this // and other resource controllers. GetTopologyHints(*v1.Pod, *v1.Container) map[string][]topologymanager.TopologyHint // GetPodTopologyHints implements the topologymanager.HintProvider Interface // and is consulted to achieve NUMA aware resource alignment among this // and other resource controllers. GetPodTopologyHints(*v1.Pod) map[string][]topologymanager.TopologyHint // GetMemoryNUMANodes provides NUMA nodes that are used to allocate the container memory GetMemoryNUMANodes(ctx context.Context, pod *v1.Pod, container *v1.Container) sets.Set[int] // GetAllocatableMemory returns the amount of allocatable memory for each NUMA node GetAllocatableMemory(ctx context.Context) []state.Block // GetMemory returns the memory allocated by a container from NUMA nodes GetMemory(ctx context.Context, podUID, containerName string) []state.Block }
Manager interface provides methods for Kubelet to manage pod memory.
func NewFakeManager ¶
NewFakeManager creates empty/fake memory manager
func NewManager ¶
func NewManager(ctx context.Context, policyName string, machineInfo *cadvisorapi.MachineInfo, nodeAllocatableReservation v1.ResourceList, reservedMemory []kubeletconfig.MemoryReservation, stateFileDirectory string, affinity topologymanager.Store) (Manager, error)
NewManager returns new instance of the memory manager
type Policy ¶
type Policy interface { Name() string Start(ctx context.Context, s state.State) error // Allocate call is idempotent Allocate(ctx context.Context, s state.State, pod *v1.Pod, container *v1.Container) error // RemoveContainer call is idempotent RemoveContainer(ctx context.Context, s state.State, podUID string, containerName string) // GetTopologyHints implements the topologymanager.HintProvider Interface // and is consulted to achieve NUMA aware resource alignment among this // and other resource controllers. GetTopologyHints(ctx context.Context, s state.State, pod *v1.Pod, container *v1.Container) map[string][]topologymanager.TopologyHint // GetPodTopologyHints implements the topologymanager.HintProvider Interface // and is consulted to achieve NUMA aware resource alignment among this // and other resource controllers. GetPodTopologyHints(ctx context.Context, s state.State, pod *v1.Pod) map[string][]topologymanager.TopologyHint // GetAllocatableMemory returns the amount of allocatable memory for each NUMA node GetAllocatableMemory(ctx context.Context, s state.State) []state.Block }
Policy implements logic for pod container to a memory assignment.
func NewPolicyBestEffort ¶
func NewPolicyBestEffort(ctx context.Context, machineInfo *cadvisorapi.MachineInfo, reserved systemReservedMemory, affinity topologymanager.Store) (Policy, error)
func NewPolicyNone ¶
NewPolicyNone returns new none policy instance
func NewPolicyStatic ¶
func NewPolicyStatic(ctx context.Context, machineInfo *cadvisorapi.MachineInfo, reserved systemReservedMemory, affinity topologymanager.Store) (Policy, error)
NewPolicyStatic returns new static policy instance
Source Files ¶
fake_memory_manager.go memory_manager.go policy.go policy_best_effort.go policy_none.go policy_static.go
Directories ¶
Path | Synopsis |
---|---|
pkg/kubelet/cm/memorymanager/state |
- Version
- v1.34.0-rc.0
- Published
- Aug 6, 2025
- Platform
- darwin/amd64
- Imports
- 26 packages
- Last checked
- 1 minute ago –
Tools for package owners.