本文整理汇总了Golang中k8s/io/kubernetes/plugin/pkg/scheduler.NewHTTPExtender函数的典型用法代码示例。如果您正苦于以下问题:Golang NewHTTPExtender函数的具体用法?Golang NewHTTPExtender怎么用?Golang NewHTTPExtender使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewHTTPExtender函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CreateFromConfig
// Creates a scheduler from the configuration file
func (f *ConfigFactory) CreateFromConfig(policy schedulerapi.Policy) (*scheduler.Config, error) {
glog.V(2).Infof("Creating scheduler from configuration: %v", policy)
// validate the policy configuration
if err := validation.ValidatePolicy(policy); err != nil {
return nil, err
}
predicateKeys := sets.NewString()
for _, predicate := range policy.Predicates {
glog.V(2).Infof("Registering predicate: %s", predicate.Name)
predicateKeys.Insert(RegisterCustomFitPredicate(predicate))
}
priorityKeys := sets.NewString()
for _, priority := range policy.Priorities {
glog.V(2).Infof("Registering priority: %s", priority.Name)
priorityKeys.Insert(RegisterCustomPriorityFunction(priority))
}
extenders := make([]algorithm.SchedulerExtender, 0)
if len(policy.ExtenderConfigs) != 0 {
for ii := range policy.ExtenderConfigs {
glog.V(2).Infof("Creating extender with config %+v", policy.ExtenderConfigs[ii])
if extender, err := scheduler.NewHTTPExtender(&policy.ExtenderConfigs[ii], policy.APIVersion); err != nil {
return nil, err
} else {
extenders = append(extenders, extender)
}
}
}
return f.CreateFromKeys(predicateKeys, priorityKeys, extenders)
}
示例2: 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)
}