refactor: separate workload class from placement driver
This commit is contained in:
@@ -14,12 +14,12 @@ import (
|
||||
type ComponentName string
|
||||
|
||||
const (
|
||||
Scheduler ComponentName = "scheduler"
|
||||
PodWorker ComponentName = "pod-worker"
|
||||
VMWorker ComponentName = "vm-worker"
|
||||
Scheduler ComponentName = "scheduler"
|
||||
KubernetesWorker ComponentName = "kubernetes-worker"
|
||||
OpenSandboxWorker ComponentName = "opensandbox-worker"
|
||||
)
|
||||
|
||||
var defaultComponents = []ComponentName{Scheduler, PodWorker, VMWorker}
|
||||
var defaultComponents = []ComponentName{Scheduler, KubernetesWorker, OpenSandboxWorker}
|
||||
|
||||
// Selection parses --components. An empty value enables all components.
|
||||
type Selection []ComponentName
|
||||
@@ -31,6 +31,12 @@ func ParseSelection(value string) (Selection, error) {
|
||||
var selected Selection
|
||||
for _, raw := range strings.Split(value, ",") {
|
||||
name := ComponentName(strings.TrimSpace(raw))
|
||||
switch name {
|
||||
case "pod-worker":
|
||||
name = KubernetesWorker
|
||||
case "vm-worker":
|
||||
name = OpenSandboxWorker
|
||||
}
|
||||
if !slices.Contains(defaultComponents, name) {
|
||||
return nil, fmt.Errorf("unknown controller component %q", name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user