mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #90282 from gaurav1086/kubelet_nodestatus_remove_check
[kubelet] nodestatus: remove map nil check
This commit is contained in:
commit
cdbd07f64e
@ -317,14 +317,12 @@ func MachineInfo(nodeName string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
devicePluginCapacity, devicePluginAllocatable, removedDevicePlugins = devicePluginResourceCapacityFunc()
|
devicePluginCapacity, devicePluginAllocatable, removedDevicePlugins = devicePluginResourceCapacityFunc()
|
||||||
if devicePluginCapacity != nil {
|
|
||||||
for k, v := range devicePluginCapacity {
|
for k, v := range devicePluginCapacity {
|
||||||
if old, ok := node.Status.Capacity[k]; !ok || old.Value() != v.Value() {
|
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())
|
klog.V(2).Infof("Update capacity for %s to %d", k, v.Value())
|
||||||
}
|
}
|
||||||
node.Status.Capacity[k] = v
|
node.Status.Capacity[k] = v
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for _, removedResource := range removedDevicePlugins {
|
for _, removedResource := range removedDevicePlugins {
|
||||||
klog.V(2).Infof("Set capacity for %s to 0 on device removal", removedResource)
|
klog.V(2).Infof("Set capacity for %s to 0 on device removal", removedResource)
|
||||||
@ -365,14 +363,12 @@ func MachineInfo(nodeName string,
|
|||||||
node.Status.Allocatable[k] = value
|
node.Status.Allocatable[k] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
if devicePluginAllocatable != nil {
|
|
||||||
for k, v := range devicePluginAllocatable {
|
for k, v := range devicePluginAllocatable {
|
||||||
if old, ok := node.Status.Allocatable[k]; !ok || old.Value() != v.Value() {
|
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())
|
klog.V(2).Infof("Update allocatable for %s to %d", k, v.Value())
|
||||||
}
|
}
|
||||||
node.Status.Allocatable[k] = v
|
node.Status.Allocatable[k] = v
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// for every huge page reservation, we need to remove it from allocatable memory
|
// for every huge page reservation, we need to remove it from allocatable memory
|
||||||
for k, v := range node.Status.Capacity {
|
for k, v := range node.Status.Capacity {
|
||||||
if v1helper.IsHugePageResourceName(k) {
|
if v1helper.IsHugePageResourceName(k) {
|
||||||
|
Loading…
Reference in New Issue
Block a user