本文整理匯總了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)
}
示例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
}