-
Notifications
You must be signed in to change notification settings - Fork 22
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
Support SharedLister for NodeInfo #115
Conversation
4b8da14
to
f892873
Compare
f892873
to
f64396c
Compare
f64396c
to
29fab6a
Compare
/cc @Gekko0114 @utam0k |
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.
Thanks!
Though I haven't finished reading all the code, I left several minor comments and questions :)
package api | ||
|
||
// ImageStateSummary provides summarized information about the state of an image. | ||
type ImageStateSummary struct { |
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.
minor comment:
Nodes field is not necessary for now?
How about leaving the comment why this field is not implemented?
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.
Nodes field is not necessary for now?
Yes, we don't use it (actually nothing uses it in upstream too).
How about leaving the comment why this field is not implemented?
I don't want to leave comments on everything unsupported. (We have too many unsupported things.
) | ||
|
||
type SharedLister interface { | ||
NodeInfos() guestapi.NodeInfoList |
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.
minor:
How about adding the comment that StorageInfos are not implemented yet?
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.
Ditto, I don't want to leave comments on everything unsupported.
@@ -49,6 +49,8 @@ func _prefilter() uint32 { //nolint | |||
// This function begins a new scheduling cycle: zero out any cycle state. | |||
currentPod = nil | |||
currentCycleState = map[string]any{} | |||
currentNodeInfoList = nil | |||
isFullNodeInfoList = false |
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.
Why does this isFullNodeInfoList
logic work? Is it because the Node used in the scheduler's step always goes through the prefilter process?
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.
Yes, we call preFilter regardless of whether an user implements preFilter or not, so that we can reset all stuff the start of the scheduling cycle.
type nodeList struct { | ||
items []proto.Node | ||
type filteredNodeInfoList struct { | ||
// It only contains the Nodes that passed the filtering phase. |
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.
Why do you define filteredNodeInfoList even though sharedLister has nodeinfos? Is this because wasm's prescore step is sometimes called without calling previous steps like prefilter?
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.
Because, as documented at this line, we have to know which nodes have gone thru the filtering phase.
As you can see in filteredNodeInfoList.lazyItems
, actually filteredNodeInfoList
utilizes nodes in sharedLister
too to use the cached nodes there.
Also, we don't want to put this "listing nodes after filtering" logic into sharedLister
because we want to keep sharedLister
pure, and "listing nodes that have gone thru the filtering phase" is specific to PreScore.
@Gekko0114 Addressed or replied to your comments. |
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.
LGTM, but leaves lgtm label for another reviewer.
Also left several minor comments.
bufLimit := bufLimit(stack[3]) | ||
|
||
var nodeName string | ||
if b, ok := mod.Memory().Read(nodename, nodenameLen); !ok { |
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.
Sorry, but at first, I couldn't understand this code.
This code retrieves the node name from the wasm module and returns nodeinfo to the wasm module, right?
Additionally, I couldn't understand why this function is necessary even though k8sSchedulerCurrentNodeNameFn exists. (I understand it now)
Could you leave a brief comment explaining this function?
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.
Added the comment though, what's unclear? (Does 2f5a3eb clarify it?)
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.
Lgtm 😀
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Gekko0114, sanposhiho 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 |
Merging the PR. @Gekko0114 (fyi @utam0k ) |
What type of PR is this?
/kind feature
/kind cleanup
What this PR does / why we need it:
ImageStates
is supported for now. We can support other fields later.Which issue(s) this PR fixes:
Fixes #70
Part of #73
Special notes for your reviewer:
Does this PR introduce a user-facing change?
What are the benchmark results of this change?