-
Notifications
You must be signed in to change notification settings - Fork 485
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
Implementation of coscheduling based on CRD [Part 1] #52
Conversation
We need to separate this PR to two @cwdsuzhou @Huang-Wei
|
cmd/coscheduling/scheduler/main.go
Outdated
_ "sigs.k8s.io/scheduler-plugins/pkg/apis/config/scheme" | ||
) | ||
|
||
func main() { |
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.
We don't need to separate main function for coscheduling.
@@ -0,0 +1,38 @@ | |||
/* |
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.
The same as scheduler, we don't need separate controller.
pkg/coscheduling/README.md
Outdated
@@ -1,7 +1,6 @@ | |||
# Overview | |||
|
|||
This folder holds the coscheduling plugin implementations based on [Lightweight coscheduling based on back-to-back queue | |||
sorting](https://github.com/kubernetes-sigs/scheduler-plugins/tree/master/kep/2-lightweight-coscheduling). | |||
This folder holds the coscheduling plugin implementations based on [Coscheduling based on PodGroup CRD](https://github.com/kubernetes-sigs/scheduler-plugins/tree/master/kep/42-podgroup-coscheduling). |
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.
Please leave the link of kep https://github.com/kubernetes-sigs/scheduler-plugins/tree/master/kep/2-lightweight-coscheduling
here.
@@ -0,0 +1,21 @@ | |||
/* |
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.
Move the apis from pkg/coscheduling/apis to pkg/apis/
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.
But I thinks this apis are only for coscheduling
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.
PodGroup is a universal concept. It maybe used by other plugins.
// MinResources defines the minimal resource of members/tasks to run the pod group; | ||
// if there's not enough resources to start all tasks, the scheduler | ||
// will not start anyone. | ||
MinResources *v1.ResourceList `json:"minResources,omitempty"` |
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.
As comments before, MinResource was going to removed.
#42 (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.
#42 (comment), this it the latest.
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.
I'm confused about how to set the MinResource. It's the total minimal resource of the PodGroup or the pod?
yes
Yes? the PodGroup or the pod?
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.
I'm confused about how to set the MinResource. It's the total minimal resource of the PodGroup or the pod?
yesYes? the PodGroup or the pod?
We have discussed about this question offline.
minimal resource of PodGroup
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.
Ok. It's better to change like this:
// MinResources defines the minimal resource of members/tasks to run the pod group; ---> // MinResources defines the minimal resource to run the pod group;
Too many difference between the existing version and this one. The existing version even can not pass the integration test. If you do not like this, we would like move it to an independent |
Please separate this PR to two firstly. |
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 for the PR @cwdsuzhou !
A high-level comment is that I'd still prefer not to mixin the implementation into this PR, i.e., it's ideal to have 2 PRs - one for CRD and controller, the 2nd one to include the implementation code. Additionally, the code structure needs to be tweaked a bit as we won't generate binaries for each plugin - all plugins will be compiled into particular type of binaries (scheduler, controller, admission, etc.).
With that said, here are my comments:
- Retitle the PR to "Implementation of coscheduling based on CRD [Part 1]"
- Move
cmd/main.go
andcmd/main_test.go
to a new pkgcmd/scheduler/
. - Make
cmd/coscheduling/controller
a generic controller, i.e., movecmd/coscheduler/controller/*
tocmd/controller
- Move
pkg/coscheduling/apis/podgroup
topkg/apis/podgroup
asPodGroup
is a generic API, and hence may consumed by multiple plugins. It also follows the upstream code structure. pkg/coscheduling/controller/*
should also go topkg/controller
, and named aspodgroup.go
.- Move
pkg/coscheduling/generated
topkg/generated
- IMO
pkg/coscheduling/scheduler/*
, along withpkg/coscheduling/coscheduler.go
can be introduced in the next PR. - Add tests to test PodGroup and controller logic only.
- Modify Dockerfile and Makefile based on latest codebase.
FYI: I've exercised some (not all) of the above comments, you can supplement based on it:
- Huang-Wei@13a7897 (CRD definition and controller logic)
- Huang-Wei@b0ac55e (codegen)
Thanks! |
a721279
to
b8c5545
Compare
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.
Just ignore the flaky test, #54 is created for tracking that.
2c00efe
to
0ad3a3a
Compare
PR updated according to your suggestions @Huang-Wei |
pkg/apis/podgroup/v1alpha1/types.go
Outdated
// +optional | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
|
||
// items is the list of PodGroup |
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.
// items is the list of PodGroup | |
// Items is the list of PodGroup |
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.
updated
There is one comment unresolved: #52 (comment). LGTM otherwise. @denkensk do you want to take another round of review? |
pkg/util/types.go
Outdated
|
||
const ( | ||
// PodGroupLabel is the default label of batch scheduler | ||
PodGroupLabel = "podgroup.scheduling.sigs.k8s.io" |
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.
podgroup.scheduling.sigs.k8s.io --> pod-group.scheduling.sigs.k8s.io
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.
IMO, podgroup is alose OK. WDYT
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.
pod-group
conforms to the naming standard of k8s. We talk about it before.- Hope to be consistent with the current implementation of the naming
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.
Ok, done!
pkg/util/types.go
Outdated
|
||
var ( | ||
// ErrorNotMatched means pod does not match batch scheduling | ||
ErrorNotMatched = fmt.Errorf("not match batch scheduling") |
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.
not match batch scheduling --> not match coscheduling
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.
Ok, thanks
Failed uint32 `json:"failed,omitempty"` | ||
|
||
// ScheduleStartTime of the group | ||
ScheduleStartTime metav1.Time `json:"scheduleStartTime,omitempty"` |
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.
ScheduleStartTime is the create time of PG ?
If So, it's better to rename it to CreateTime?
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 is field just record when the group starts scheduling
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, It also need to add the field to record the create time of PG.
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.
MetaData of CRD already includes this field!
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.
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.
Ok, Thanks
Change codes according to round 1 suggestions Update PR based on suggestions
/approve leaving /lgtm to @denkensk |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cwdsuzhou, Huang-Wei 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 |
ping @denkensk |
/unhold |
seems not work. May be you should left only /lgtm ? |
/lgtm |
Part 1: we implement the controller and crd
.
/cc @Huang-Wei