mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #6967 from HaiyangDING/ListAlgos
Listing existing algorithm providers in scheduler
This commit is contained in:
		@@ -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)")
 | 
			
		||||
 
 | 
			
		||||
@@ -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, " | ")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user