-
Notifications
You must be signed in to change notification settings - Fork 550
add validate for NodeResourcesAllocatable and Coscheduling plugin #888
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
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for kubernetes-sigs-scheduler-plugins canceled.
|
51d9d8d
to
4d175be
Compare
/assign @Huang-Wei |
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.
overall seems OK, some inline comments
var supportNodeResourcesMode = sets.NewString( | ||
string(config.Least), | ||
string(config.Most), | ||
) |
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 should probably be done in init
or similar initialization 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.
done
string(config.Most), | ||
) | ||
|
||
func validateNodeResourcesModeType(mode config.ModeType, path *field.Path) *field.Error { |
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.
if ModeType
is an enum-like type (is it right?) how can it be different than the enumerated value? isn't the golang type system preventing this?
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.
IIUC, we do not have enum restrictions on the configuration file, users may fill in any policy. 🤔
// NodeResourcesAllocatableArgs holds arguments used to configure NodeResourcesAllocatable plugin.
type NodeResourcesAllocatableArgs struct {
metav1.TypeMeta `json:",inline"`
// Resources to be considered when scoring.
// Allowed weights start from 1.
// An example resource set might include "cpu" (millicores) and "memory" (bytes)
// with weights of 1<<20 and 1 respectfully. That would mean 1 MiB has equivalent
// weight as 1 millicore.
Resources []schedconfig.ResourceSpec `json:"resources,omitempty"`
// Whether to prioritize nodes with least or most allocatable resources.
Mode ModeType `json:"mode,omitempty"`
}
4d175be
to
8cd2e70
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: googs1025 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: googs1025 <[email protected]>
8cd2e70
to
e070ce1
Compare
What type of PR is this?
/kind feature
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #887
Special notes for your reviewer:
Does this PR introduce a user-facing change?