diff --git a/simulator/docs/custom-plugin.md b/simulator/docs/custom-plugin.md index 46770a6d5..42ef55b94 100644 --- a/simulator/docs/custom-plugin.md +++ b/simulator/docs/custom-plugin.md @@ -19,7 +19,7 @@ by passing a default KubeSchedulerConfiguration file via the environment variabl ### Example -We will explain the case where you want to add [nodenumber](../sample/nodenumber/plugin.go) plugin as example. +We will explain the case where you want to add [nodenumber](./sample/nodenumber/plugin.go) plugin as example. The nodenumber plugin is an example plugin that favors nodes that have the number suffix which is the same as the number suffix of the pod name. And we can configure it via `NodeNumberArgs`. diff --git a/simulator/scheduler/config/plugin.go b/simulator/scheduler/config/plugin.go index f8e8233cf..394215a36 100644 --- a/simulator/scheduler/config/plugin.go +++ b/simulator/scheduler/config/plugin.go @@ -7,13 +7,9 @@ import ( "k8s.io/kubernetes/pkg/scheduler/framework/runtime" ) -var ( - outOfTreeRegistries = runtime.Registry{ - // TODO(user): add your plugins registries here. - } - - registeredOutOfTreeMultiPointName = []string{} -) +var outOfTreeRegistries = runtime.Registry{ + // TODO(user): add your plugins registries here. +} // RegisteredMultiPointPluginNames returns all registered multipoint plugin names. // in-tree plugins and your original plugins listed in outOfTreeRegistries above. @@ -43,6 +39,10 @@ func InTreeMultiPointPluginSet() (configv1.PluginSet, error) { } func OutOfTreeMultiPointPluginNames() []string { + registeredOutOfTreeMultiPointName := make([]string, 0, len(outOfTreeRegistries)) + for k := range outOfTreeRegistries { + registeredOutOfTreeMultiPointName = append(registeredOutOfTreeMultiPointName, k) + } return registeredOutOfTreeMultiPointName } @@ -57,6 +57,5 @@ func OutOfTreeRegistries() runtime.Registry { func SetOutOfTreeRegistries(r runtime.Registry) { for k, v := range r { outOfTreeRegistries[k] = v - registeredOutOfTreeMultiPointName = append(registeredOutOfTreeMultiPointName, k) } }