-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add node image information to the cache of the scheduler. #2593
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
Conversation
Signed-off-by: wangyang <[email protected]>
e206cac to
4e77863
Compare
| import ( | ||
| "context" | ||
| "fmt" | ||
| "k8s.io/kubernetes/pkg/scheduler/framework" |
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 we need to import this package in this file?
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.
This package is referenced when imageState is used to initialize ImageStateSummary. This package is introduced by the createImageStateSummary function added to the cache file.
| size: image.SizeBytes, | ||
| nodes: sets.NewString(node.Name), | ||
| } | ||
| sc.imageStates[name] = state |
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.
where we use the data from sc.imageStates[name]? Is it enough that we only store image data in nodeinfo?
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.
sc.imageStates stores the image information of all nodes in the cluster. The image name is key, and the information about the node that owns the image is value.
When a node is added or deleted, the system updates the information in sc.imageStates and updates the imageStates information in nodeInfo of the current node through sc.imageStates. The scheduler scores the node based on the imageStates information in nodeInfo of each node.
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.
imageState in nodeinfo is necessary. I want to know the necessary of sc.imagestates.
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.
sc.imageStates maintains the image distribution information of all nodes in the cluster. When a node is added or deleted, sc.imageStates is updated. If sc.imageStates does not exist, all nodeinfo needs to be traversed for recalculation each time a node is added or deleted, which affects the performance and efficiency.
In addition, sc.imageStates is properly stored in the scheduler cache. Other structures are not found to store cluster imageStates information.
william-wang
left a comment
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: william-wang The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: wangyang [email protected]
fix: #2496
Verify and update based on #2543 due to contributor project adjustment. Thanks @zhifanggao
Add ImageStates information to the cache of Volcano for trial use of the imagelocality policy.
Note:
Kubernetes uses the Docker engine. When the image name is matched, the prefix name matching is incomplete. #112699