本文整理汇总了Golang中k8s/io/kubernetes/plugin/pkg/scheduler/api.ExtenderConfig.HTTPTimeout方法的典型用法代码示例。如果您正苦于以下问题:Golang ExtenderConfig.HTTPTimeout方法的具体用法?Golang ExtenderConfig.HTTPTimeout怎么用?Golang ExtenderConfig.HTTPTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/plugin/pkg/scheduler/api.ExtenderConfig
的用法示例。
在下文中一共展示了ExtenderConfig.HTTPTimeout方法的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
}