kubelet: fix nil crash in allocateRemainingFrom

This commit is contained in:
Ryan Phillips 2022-10-12 12:47:21 -05:00
parent 4516c7972d
commit 2514486d80

View File

@ -564,16 +564,16 @@ func (m *ManagerImpl) devicesToAllocate(podUID, contName, resource string, requi
return false
}
// Allocates from reusableDevices list first.
if allocateRemainingFrom(reusableDevices) {
return allocated, nil
}
// Needs to allocate additional devices.
if m.allocatedDevices[resource] == nil {
m.allocatedDevices[resource] = sets.NewString()
}
// Allocates from reusableDevices list first.
if allocateRemainingFrom(reusableDevices) {
return allocated, nil
}
// Gets Devices in use.
devicesInUse := m.allocatedDevices[resource]
// Gets Available devices.