mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-19 07:25:19 +00:00
This change completes the contextual logging migration for the memory manager by updating the Manager interface and all implementations to accept logr.Logger parameters instead of context.Context. Key changes: - Update Manager interface methods to accept logr.Logger: * AddContainer, RemoveContainer, GetMemoryNUMANodes * GetAllocatableMemory, GetMemory (removed context entirely) - Update Policy interface methods to accept logr.Logger instead of context.Context - Pass logger to NewManager() and policy constructors (NewPolicyStatic, NewPolicyNone, NewPolicyBestEffort) - Update internal_container_lifecycle to use klog.TODO() when calling memory manager methods - Update fake manager to accept and use logger parameter - Update all test code to pass logger instead of context This aligns with the contextual logging migration pattern where: - Functions that need a logger accept logr.Logger parameter directly - Logger is passed from the boundary (e.g., Start()) down to implementation - klog.TODO() is used temporarily in call sites where logger is not yet available - Context is only used where truly needed (e.g., Start() method) This follows the same pattern as recent migrations in: - pkg/kubelet/cm/topologymanager (#134174) - pkg/kubelet/cm/devicemanager (#134293) - pkg/kubelet/cm/cpumanager (#125912) Related to the initial memory manager contextual logging work in #130727. Signed-off-by: Swati Sehgal <swsehgal@redhat.com>