當前位置: 首頁>>代碼示例>>Golang>>正文


Golang api.ExtenderConfig類代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/plugin/pkg/scheduler/api.ExtenderConfig的典型用法代碼示例。如果您正苦於以下問題:Golang ExtenderConfig類的具體用法?Golang ExtenderConfig怎麽用?Golang ExtenderConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ExtenderConfig類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: main

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)
}
開發者ID:hqzhang,項目名稱:Mytest,代碼行數:19,代碼來源:k8s.go

示例2: NewHTTPExtender

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
}
開發者ID:Clarifai,項目名稱:kubernetes,代碼行數:22,代碼來源:extender.go


注:本文中的k8s/io/kubernetes/plugin/pkg/scheduler/api.ExtenderConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。