-
Notifications
You must be signed in to change notification settings - Fork 40.9k
[KEP-2400] Report swap capacity as part of node.status.nodeSystemInfo #129954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[KEP-2400] Report swap capacity as part of node.status.nodeSystemInfo #129954
Conversation
Skipping CI for Draft Pull Request. |
fa23791
to
732802a
Compare
Unit tests fail locally on the master branch and do not seem related:
|
Bisected to #125102 |
Shouldn't this have some validation? Is it OK to set 0 here? Is it OK to set a negative number? It looks like node.status validation is sloppy, that doesn't mean we should make it worse. Whatever the validation rules are should be commented on the field and enforced in pkg/apis/core/validation/validation.go |
7534356
to
42efd31
Compare
Yeah, I've added some. Thanks!
If the capacity is 0 kubelet will leave the field to be nil.
Thanks for the pointer! |
Failures look like CI outage. |
makeNode := func(swapCapacity *int64) core.Node { | ||
node := makeNode("test-node", nil) | ||
if swapCapacity != nil { | ||
node.Status.NodeInfo.Swap = &core.NodeSwapStatus{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about when node.Status.NodeInfo.Swap == nil
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you can reframe it as
makeNode := func(swap *NodeSwapStatus) *Node { ... }
makeSwapStatus := func(capacity int64) *NodeSwapStatus { ... }
and then the testcases are:
makeNode(nil) // nil swap status
makeNode(&NodeSwapStatus{}) // nil capacity
makeNode(makeSwapStatus(123456))
makeNode(makeSwapStatus(0))
makeNode(makeSwapStatus(-123456))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thockin Done. PTAL.
42efd31
to
8ae0b0d
Compare
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
Signed-off-by: Itamar Holder <[email protected]>
8ae0b0d
to
1ae091e
Compare
Thanks! /lgtm |
LGTM label has been added. Git tree hash: ffe61db0e42a5a8e878f6b077438282d83703ae0
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dchen1107, iholder101, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
/test pull-kubernetes-integration |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Currently, there isn't an easy way to know the swap capacity for each node. It is available as part of Summary API, however it is both hard to read and demands certain permissions to use.
This PR adds the swap capacity into the node status, specifically under
node.Status.NodeInfo.Swap
.Example for a node with 40GB swap capacity (trimmed for readability):
Special notes for your reviewer:
I've tried to address this need in multiple past attempts.
In the first one, #123963, I've tried to add swap as another
ReasourceName
, hence to display it as part ofkubectl describe node
's status. This attempt was eventually denied with the main concern being that adding swap as aResourceName
is confusing since it cannot be directly/explicitly consumed (since the swap limit is auto-calculated).In the second one, #125278, I've tried to add a swap condition to nodes. This PR was also denied with the main concern being that a condition is not suited to report such data, and that a field is recommended in this case.
I have also created another PR #129458 to add swap stats to
kubectl top
subcommands. However, this PR is currently blocked since it seems that using Summary API is problematic in terms of permissions, demonstrating again that a field for swap capacity is needed.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: