Skip to content

Commit 5ed70c6

Browse files
committed
[kubelet] nodestatus: remove slice nil check
1 parent c70e3e9 commit 5ed70c6

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

pkg/kubelet/nodestatus/setters.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,11 @@ func MachineInfo(nodeName string,
317317
}
318318

319319
devicePluginCapacity, devicePluginAllocatable, removedDevicePlugins = devicePluginResourceCapacityFunc()
320-
if devicePluginCapacity != nil {
321-
for k, v := range devicePluginCapacity {
322-
if old, ok := node.Status.Capacity[k]; !ok || old.Value() != v.Value() {
323-
klog.V(2).Infof("Update capacity for %s to %d", k, v.Value())
324-
}
325-
node.Status.Capacity[k] = v
320+
for k, v := range devicePluginCapacity {
321+
if old, ok := node.Status.Capacity[k]; !ok || old.Value() != v.Value() {
322+
klog.V(2).Infof("Update capacity for %s to %d", k, v.Value())
326323
}
324+
node.Status.Capacity[k] = v
327325
}
328326

329327
for _, removedResource := range removedDevicePlugins {
@@ -365,13 +363,11 @@ func MachineInfo(nodeName string,
365363
node.Status.Allocatable[k] = value
366364
}
367365

368-
if devicePluginAllocatable != nil {
369-
for k, v := range devicePluginAllocatable {
370-
if old, ok := node.Status.Allocatable[k]; !ok || old.Value() != v.Value() {
371-
klog.V(2).Infof("Update allocatable for %s to %d", k, v.Value())
372-
}
373-
node.Status.Allocatable[k] = v
366+
for k, v := range devicePluginAllocatable {
367+
if old, ok := node.Status.Allocatable[k]; !ok || old.Value() != v.Value() {
368+
klog.V(2).Infof("Update allocatable for %s to %d", k, v.Value())
374369
}
370+
node.Status.Allocatable[k] = v
375371
}
376372
// for every huge page reservation, we need to remove it from allocatable memory
377373
for k, v := range node.Status.Capacity {

0 commit comments

Comments
 (0)