|
@@ -2,29 +2,29 @@
|
|
|
|
|
|
## 1. Create your custom plugin
|
|
|
There is a list of stages during the scheduling procedure you can interve as it also stated in [scheduling framework- v1.17](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/):
|
|
|
-#### Queue sort[](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#queue-sort)
|
|
|
+#### [Queue sort](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#queue-sort)
|
|
|
|
|
|
These plugins are used to sort Pods in the scheduling queue. A queue sort plugin essentially will provide a “less(Pod1, Pod2)” function. Only one queue sort plugin may be enabled at a time.
|
|
|
|
|
|
-#### Pre-filter[](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#pre-filter)
|
|
|
+#### [Pre-filter](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#pre-filter)
|
|
|
|
|
|
These plugins are used to pre-process info about the Pod, or to check certain conditions that the cluster or the Pod must meet. If a pre-filter plugin returns an error, the scheduling cycle is aborted.
|
|
|
|
|
|
-#### Filter[](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#filter)
|
|
|
+#### [Filter](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#filter)
|
|
|
|
|
|
These plugins are used to filter out nodes that cannot run the Pod. For each node, the scheduler will call filter plugins in their configured order. If any filter plugin marks the node as infeasible, the remaining plugins will not be called for that node. Nodes may be evaluated concurrently.
|
|
|
|
|
|
-#### Post-filter[](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#post-filter)
|
|
|
+#### [Post-filter](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#post-filter)
|
|
|
|
|
|
This is an informational extension point. Plugins will be called with a list of nodes that passed the filtering phase. A plugin may use this data to update internal state or to generate logs/metrics.
|
|
|
|
|
|
**Note:** Plugins wishing to perform “pre-scoring” work should use the post-filter extension point.
|
|
|
|
|
|
-#### Scoring[](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#scoring)
|
|
|
+#### [Scoring](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#scoring)
|
|
|
|
|
|
These plugins are used to rank nodes that have passed the filtering phase. The scheduler will call each scoring plugin for each node. There will be a well defined range of integers representing the minimum and maximum scores. After the [normalize scoring](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#normalize-scoring) phase, the scheduler will combine node scores from all plugins according to the configured plugin weights.
|
|
|
|
|
|
-#### Normalize scoring[](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#normalize-scoring)
|
|
|
+#### [Normalize scoring](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#normalize-scoring)
|
|
|
|
|
|
These plugins are used to modify scores before the scheduler computes a final ranking of Nodes. A plugin that registers for this extension point will be called with the [scoring](https://kubernetes.io/docs/concepts/configuration/scheduling-framework/#scoring) results from the same plugin. This is called once per plugin per scheduling cycle.
|
|
|
|
|
@@ -72,3 +72,33 @@ func NewInTreeRegistry() framework.Registry {
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
+
|
|
|
+## 3. Enable the plugin
|
|
|
+You can enable or disable plugins using the configuration yaml file on runtime. However, here we will show the hard-coded way.
|
|
|
+
|
|
|
+By editing the `pkg/scheduler/algorithmprovider/registry.go` file.
|
|
|
+
|
|
|
+```go
|
|
|
+func getDefaultConfig() *schedulerapi.Plugins {
|
|
|
+
|
|
|
+ return &schedulerapi.Plugins{
|
|
|
+
|
|
|
+...
|
|
|
+
|
|
|
+ Score: &schedulerapi.PluginSet{
|
|
|
+
|
|
|
+ Enabled: []schedulerapi.Plugin{
|
|
|
+
|
|
|
+ {Name: noderesources.CustomAllocatedName, Weight: 100000},
|
|
|
+
|
|
|
+ {Name: imagelocality.Name, Weight: 1},
|
|
|
+
|
|
|
+ ...
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+...
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+```
|