Fix: kubelet return error when device plugin sets PreStartRequired true while creating pods with 0 resource

This commit is contained in:
fighterhit 2020-11-21 21:56:20 +08:00 committed by wangjunwei01
parent ece591f722
commit 0eaceb7eb5

View File

@ -932,9 +932,9 @@ func (m *ManagerImpl) GetDeviceRunContainerOptions(pod *v1.Pod, container *v1.Co
podUID := string(pod.UID)
contName := container.Name
needsReAllocate := false
for k := range container.Resources.Limits {
for k, v := range container.Resources.Limits {
resource := string(k)
if !m.isDevicePluginResource(resource) {
if !m.isDevicePluginResource(resource) || v.Value() == 0 {
continue
}
err := m.callPreStartContainerIfNeeded(podUID, contName, resource)