Skip to content

Commit

Permalink
Listing available algorithm providers in scheduler
Browse files Browse the repository at this point in the history
List the available algorithm providers with 'kube-scheduler --help' under field `algorithm_provider`
  • Loading branch information
dingh committed Apr 21, 2015
1 parent d84393c commit 71b9884
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/cmd/kube-scheduler/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
10 changes: 10 additions & 0 deletions plugin/pkg/scheduler/factory/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package factory
import (
"fmt"
"regexp"
"strings"
"sync"

algorithm "github.com/GoogleCloudPlatform/kubernetes/pkg/scheduler"
Expand Down Expand Up @@ -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, " | ")
}

0 comments on commit 71b9884

Please sign in to comment.