Skip to content

Commit 35ef183

Browse files
committed
use enable instead of disable for plugin config
1 parent c7d5b09 commit 35ef183

File tree

3 files changed

+41
-13
lines changed

3 files changed

+41
-13
lines changed

cloud/scheduler/README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ Basic flow of the node selection process is `filter => score => select one node
88

99
### Filter Plugins
1010

11-
Filter plugins filter the node based on nodename, overcommit ratio etc.
11+
Filter plugins filter the node based on nodename, overcommit ratio etc. So that we can avoid to run qemus on not desired Proxmox nodes.
12+
13+
- [NodeName plugin](./plugins/nodename/node_name.go) (pass the node matching specified node name)
14+
- [CPUOvercommit plugin](./plugins/overcommit/cpu_overcommit.go) (pass the node that has enough cpu against running vm)
15+
- [MemoryOvercommit plugin](./plugins/overcommit/memory_overcommit.go) (pass the node that has enough memory against running vm)
16+
- [NodeRegex plugin](./plugins/regex/node_regex.go) (pass the node matching specified regex)
1217

1318
#### regex plugin
1419

@@ -20,11 +25,17 @@ value(example): node[0-9]+
2025

2126
### Score Plugins
2227

23-
Score plugins score the nodes based on resource etc.
28+
Score plugins score the nodes based on resource etc. So that we can run qemus on the most appropriate Proxmox node.
29+
30+
- [NodeResource plugin](./plugins/noderesource/node_resrouce.go) (nodes with more resources have higher scores)
31+
- [Random plugin](./plugins/random/random.go) (just a reference implementation of score plugin)
2432

2533
## How to specify vmid
2634
qemu-scheduler reads context and find key registerd to scheduler. If the context has any value of the registerd key, qemu-scheduler uses the plugin that matchies the key.
2735

36+
- [Range plugin](./plugins/idrange/idrange.go) (select minimum availabe vmid from the specified id range)
37+
- [VMIDRegex plugin](./plugins/regex/vmid_regex.go) (select minimum availabe vmid matching specified regex)
38+
2839
### Range Plugin
2940
You can specify vmid range with `(start id)-(end id)` format.
3041
```sh
@@ -64,4 +75,21 @@ spec:
6475
metadata:
6576
annotations:
6677
node.qemu-scheduler/regex: node[0-9]+ # this annotation will be propagated to your ProxmoxMachine via MachineSet
78+
```
79+
80+
## How to configure (or disable/enable) specific Plugins
81+
82+
By default, all the plugins are enabled. You can disable specific plugins via plugin-config.
83+
```sh
84+
# example plugin-config.yaml
85+
86+
# plugin type name (scores, filters, vmids)
87+
scores:
88+
- Random:
89+
enable: false # disable
90+
filters:
91+
- CPUOvercommit:
92+
enable: false # disable
93+
- MemoryOvercommit:
94+
enable true # enable (can be omitted)
6795
```

cloud/scheduler/plugins/registry.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type PluginConfigs struct {
2121
}
2222

2323
type pluginConfig struct {
24-
Disable bool `yaml:"disable,omitempty"`
25-
Config map[string]interface{} `yaml:"config,omitempty"`
24+
Enable bool `yaml:"enable,omitempty"`
25+
Config map[string]interface{} `yaml:"config,omitempty"`
2626
}
2727

2828
type PluginRegistry struct {
@@ -62,7 +62,7 @@ func NewNodeFilterPlugins(config map[string]pluginConfig) []framework.NodeFilter
6262
plugins := []framework.NodeFilterPlugin{}
6363
for _, pl := range pls {
6464
c, ok := config[pl.Name()]
65-
if ok && c.Disable {
65+
if ok && !c.Enable {
6666
continue
6767
}
6868
plugins = append(plugins, pl)
@@ -78,7 +78,7 @@ func NewNodeScorePlugins(config map[string]pluginConfig) []framework.NodeScorePl
7878
plugins := []framework.NodeScorePlugin{}
7979
for _, pl := range pls {
8080
c, ok := config[pl.Name()]
81-
if ok && c.Disable {
81+
if ok && !c.Enable {
8282
continue
8383
}
8484
plugins = append(plugins, pl)
@@ -94,7 +94,7 @@ func NewVMIDPlugins(config map[string]pluginConfig) []framework.VMIDPlugin {
9494
plugins := []framework.VMIDPlugin{}
9595
for _, pl := range pls {
9696
c, ok := config[pl.Name()]
97-
if ok && c.Disable {
97+
if ok && !c.Enable {
9898
continue
9999
}
100100
plugins = append(plugins, pl)

config/manager/manager.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ data:
129129
plugin-config.yaml: |
130130
scores:
131131
- Random:
132-
disable: true
133-
# filters:
134-
# - CPUOvercommit:
135-
# disable: true
136-
# - MemoryOvercommit:
137-
# disable: true
132+
enable: false
133+
filters:
134+
- CPUOvercommit:
135+
enable: false
136+
- MemoryOvercommit:
137+
enable: false

0 commit comments

Comments
 (0)