Merge pull request #6967 from HaiyangDING/ListAlgos

Listing existing algorithm providers in scheduler
This commit is contained in:
Brian Grant 2015-04-22 07:04:05 -07:00
commit 740d2a5f8a
2 changed files with 11 additions and 1 deletions

View File

@ -70,7 +70,7 @@ func NewSchedulerServer() *SchedulerServer {
func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
fs.IntVar(&s.Port, "port", s.Port, "The port that the scheduler's http service runs on")
fs.Var(&s.Address, "address", "The IP address to serve on (set to 0.0.0.0 for all interfaces)")
fs.StringVar(&s.AlgorithmProvider, "algorithm_provider", s.AlgorithmProvider, "The scheduling algorithm provider to use")
fs.StringVar(&s.AlgorithmProvider, "algorithm_provider", s.AlgorithmProvider, "The scheduling algorithm provider to use, one of: "+factory.ListAlgorithmProviders())
fs.StringVar(&s.PolicyConfigFile, "policy_config_file", s.PolicyConfigFile, "File with scheduler policy configuration")
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")

View File

@ -19,6 +19,7 @@ package factory
import (
"fmt"
"regexp"
"strings"
"sync"
algorithm "github.com/GoogleCloudPlatform/kubernetes/pkg/scheduler"
@ -300,3 +301,12 @@ func validatePriorityOrDie(priority schedulerapi.PriorityPolicy) {
}
}
}
// ListAlgorithmProviders is called when listing all available algortihm providers in `kube-scheduler --help`
func ListAlgorithmProviders() string {
var availableAlgorithmProviders []string
for name := range algorithmProviderMap {
availableAlgorithmProviders = append(availableAlgorithmProviders, name)
}
return strings.Join(availableAlgorithmProviders, " | ")
}