当前位置: 首页>>代码示例>>Golang>>正文


Golang ExtenderConfig.HTTPTimeout方法代码示例

本文整理汇总了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)
}
开发者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.HTTPTimeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。