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.
This commit is contained in:
Adelina Tuvenie 2020-03-10 19:11:05 +01:00
parent 61847eab61
commit a9f834d17d

View File

@ -54,6 +54,14 @@ type containerManagerImpl struct {
nodeConfig NodeConfig 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, func (cm *containerManagerImpl) Start(node *v1.Node,
activePods ActivePodsFunc, activePods ActivePodsFunc,
sourcesReady config.SourcesReady, sourcesReady config.SourcesReady,
@ -178,7 +186,7 @@ func (cm *containerManagerImpl) ShouldResetExtendedResourceCapacity() bool {
} }
func (cm *containerManagerImpl) GetAllocateResourcesPodAdmitHandler() lifecycle.PodAdmitHandler { func (cm *containerManagerImpl) GetAllocateResourcesPodAdmitHandler() lifecycle.PodAdmitHandler {
return nil return &noopWindowsResourceAllocator{}
} }
func (cm *containerManagerImpl) UpdateAllocatedDevices() { func (cm *containerManagerImpl) UpdateAllocatedDevices() {