Ejemplo n.º 1
0
func main() {

	plugin_url_ptr := flag.String("Scheduler Plugin", "http://192.168.3.2"+rest.PluginRestPort, "Scheduler Plugin url:port")
	flag.Parse()
	fmt.Println("Scheduler Plugin running at ", *plugin_url_ptr)
	//used for testing old version
	//rest.K8s2Plugin(*plugin_url_ptr)
	//extender, err := scheduler.NewHTTPExtender(&policy.ExtenderConfigs[ii], policy.APIVersion)
	var config schedulerapi.ExtenderConfig
	config.URLPrefix = "http://192.168.3.2:8084"
	config.FilterVerb = "filter"
	config.PrioritizeVerb = "prioritize"
	config.Weight = 1
	config.EnableHttps = false
	config.TLSConfig = nil
	config.HTTPTimeout = DefaultExtenderTimeout
	scheduler.NewHTTPExtender(&config, rest.APIVERSION)
	extenderRequst(*plugin_url_ptr)
}
Ejemplo n.º 2
0
func NewHTTPExtender(config *schedulerapi.ExtenderConfig, apiVersion string) (algorithm.SchedulerExtender, error) {
	if config.HTTPTimeout.Nanoseconds() == 0 {
		config.HTTPTimeout = time.Duration(DefaultExtenderTimeout)
	}

	transport, err := makeTransport(config)
	if err != nil {
		return nil, err
	}
	client := &http.Client{
		Transport: transport,
		Timeout:   config.HTTPTimeout,
	}
	return &HTTPExtender{
		extenderURL:    config.URLPrefix,
		apiVersion:     apiVersion,
		filterVerb:     config.FilterVerb,
		prioritizeVerb: config.PrioritizeVerb,
		weight:         config.Weight,
		client:         client,
	}, nil
}