-
Notifications
You must be signed in to change notification settings - Fork 38
feat: scheduler (8/): add more scheduler framework logic #389
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
Changes from all commits
9a1de88
aa13324
0c7d0bf
90d2ec1
d3aebd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,49 @@ import ( | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| const ( | ||
| // DispatcherFinalizer is added by the dispatcher to make sure that a binding can only be deleted if the dispatcher | ||
| // has removed all selected resources from the bound cluster. | ||
| DispatcherFinalizer = fleetPrefix + "dispatcher-cleanup" | ||
|
|
||
| // SchedulerFinalizer is added by the scheduler to make sure that a binding can only be deleted if the scheduler | ||
| // has relieved it from scheduling consideration. | ||
| SchedulerFinalizer = fleetPrefix + "scheduler-cleanup" | ||
|
|
||
| // ActiveBindingLabel is added by the update controller to mark that a binding is active, i.e., the dispatcher | ||
| // should place resources to it. | ||
| // | ||
| // Note that an active binding may not be associated with the latest scheduling policy snapshot or the latest | ||
| // resource snapshot. It may be up to another controller, e.g., the rolling update controller, to modify the | ||
| // association (if applicable). In certain cases (e.g., not enough fitting clusters), the binding may not even | ||
| // has a target cluster. | ||
| // | ||
| // Note also that it is not the scheduler's responsibility to add this label, even though it does | ||
| // reads this label to inform the scheduling cycle.. | ||
| ActiveBindingLabel = fleetPrefix + "is-active-binding" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The states are kept as labels for easier queries; a field would also work though. Anti-tempering is needed to make sure that the system functions correctly. |
||
|
|
||
| // CreatingBindingLabel is added by the scheduler to mark that a binding is being created. Any binding in | ||
| // this state should not be picked up by the dispatcher. | ||
| // | ||
| // Note that the scheduler **always** produces enough number of bindings, as user specified, after a scheduling run, | ||
| // even if there might not be enough number of fitting clusters. | ||
| // | ||
| // Note also that it is up to another controller, e.g., the rolling update controller, to mark a creating | ||
| // binding as active. | ||
| CreatingBindingLabel = fleetPrefix + "is-creating-binding" | ||
|
|
||
| // ObsoleteBindingLabel is added by the scheduler to mark that a binding is no longer needed, i.e., its | ||
| // associated cluster (if any) no longer fits the current (as seen by the scheduler) scheduling policy. | ||
| // | ||
| // Note that it is up to another controller, e.g, the rolling update controller, to actually delete the | ||
| // binding. | ||
| ObsoleteBindingLabel = fleetPrefix + "is-obsolete-binding" | ||
|
|
||
| // NoTargetClusterBindingLabel is added by the scheduler to mark that a binding does not have a target cluster. | ||
| // This usually happens when there is not enough number of fitting clusters in the system. | ||
| NoTargetClusterBindingLabel = fleetPrefix + "no-target-cluster-binding" | ||
| ) | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:resource:scope=Cluster,categories={fleet},shortName=rb | ||
| // +kubebuilder:subresource:status | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Technically speaking, since at this moment user no longer has the permission to delete bindings manually, we do not need this finalizer any more (it was originally designed for making sure that the scheduler will always get notified when a binding is deleted so that it can creates a new one in replacement).
However, in this PR I preserved this finalizer just for the case where a binding still needs to be manually deleted, in case of, say, troubleshooting, emergency fix, or future support for individual eviction -> it might not be optimal if the only way for a customer to remove resources from a cluster is to trigger a rescheduling via policy update; though at this stage it might not be of too much concern.