Merge pull request #90282 from gaurav1086/kubelet_nodestatus_remove_check

[kubelet] nodestatus: remove map nil check
This commit is contained in:
Kubernetes Prow Robot 2020-05-21 22:42:38 -07:00 committed by GitHub
commit cdbd07f64e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,13 +317,11 @@ func MachineInfo(nodeName string,
}
devicePluginCapacity, devicePluginAllocatable, removedDevicePlugins = devicePluginResourceCapacityFunc()
if devicePluginCapacity != nil {
for k, v := range devicePluginCapacity {
if old, ok := node.Status.Capacity[k]; !ok || old.Value() != v.Value() {
klog.V(2).Infof("Update capacity for %s to %d", k, v.Value())
}
node.Status.Capacity[k] = v
for k, v := range devicePluginCapacity {
if old, ok := node.Status.Capacity[k]; !ok || old.Value() != v.Value() {
klog.V(2).Infof("Update capacity for %s to %d", k, v.Value())
}
node.Status.Capacity[k] = v
}
for _, removedResource := range removedDevicePlugins {
@ -365,13 +363,11 @@ func MachineInfo(nodeName string,
node.Status.Allocatable[k] = value
}
if devicePluginAllocatable != nil {
for k, v := range devicePluginAllocatable {
if old, ok := node.Status.Allocatable[k]; !ok || old.Value() != v.Value() {
klog.V(2).Infof("Update allocatable for %s to %d", k, v.Value())
}
node.Status.Allocatable[k] = v
for k, v := range devicePluginAllocatable {
if old, ok := node.Status.Allocatable[k]; !ok || old.Value() != v.Value() {
klog.V(2).Infof("Update allocatable for %s to %d", k, v.Value())
}
node.Status.Allocatable[k] = v
}
// for every huge page reservation, we need to remove it from allocatable memory
for k, v := range node.Status.Capacity {