Skip to content

Commit 16871a1

Browse files
committed
populate the new node.status.nodeInfo.swapInfo field
Signed-off-by: Itamar Holder <[email protected]>
1 parent a9b0211 commit 16871a1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/kubelet/nodestatus/setters.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
4545
"k8s.io/kubernetes/pkg/kubelet/events"
4646
netutils "k8s.io/utils/net"
47+
"k8s.io/utils/ptr"
4748

4849
"k8s.io/klog/v2"
4950
)
@@ -354,6 +355,12 @@ func MachineInfo(nodeName string,
354355
// node status.
355356
node.Status.Capacity[v1.ResourceName(removedResource)] = *resource.NewQuantity(int64(0), resource.DecimalSI)
356357
}
358+
359+
if utilfeature.DefaultFeatureGate.Enabled(features.NodeSwap) && info.SwapCapacity != 0 {
360+
node.Status.NodeInfo.Swap = &v1.NodeSwapStatus{
361+
Capacity: ptr.To(int64(info.SwapCapacity)),
362+
}
363+
}
357364
}
358365

359366
// Set Allocatable.

0 commit comments

Comments
 (0)