From a9f834d17dc990bd3ba282b51d784a567ecb86d6 Mon Sep 17 00:00:00 2001 From: Adelina Tuvenie Date: Tue, 10 Mar 2020 19:11:05 +0100 Subject: [PATCH] Implement noopWindowsResourceAllocator On Windows, the podAdmitHandler returned by the GetAllocateResourcesPodAdmitHandler() func and registered by the Kubelet is nil. We implement a noopWindowsResourceAllocator that would admit any pod for Windows in order to be consistent with the original implementation. --- pkg/kubelet/cm/container_manager_windows.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/cm/container_manager_windows.go b/pkg/kubelet/cm/container_manager_windows.go index 5562951fa0f..50e25ca4b58 100644 --- a/pkg/kubelet/cm/container_manager_windows.go +++ b/pkg/kubelet/cm/container_manager_windows.go @@ -54,6 +54,14 @@ type containerManagerImpl struct { nodeConfig NodeConfig } +type noopWindowsResourceAllocator struct{} + +func (ra *noopWindowsResourceAllocator) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAdmitResult { + return lifecycle.PodAdmitResult{ + Admit: true, + } +} + func (cm *containerManagerImpl) Start(node *v1.Node, activePods ActivePodsFunc, sourcesReady config.SourcesReady, @@ -178,7 +186,7 @@ func (cm *containerManagerImpl) ShouldResetExtendedResourceCapacity() bool { } func (cm *containerManagerImpl) GetAllocateResourcesPodAdmitHandler() lifecycle.PodAdmitHandler { - return nil + return &noopWindowsResourceAllocator{} } func (cm *containerManagerImpl) UpdateAllocatedDevices() {