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


Golang scheduler.NewHTTPExtender函數代碼示例

本文整理匯總了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)
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:34,代碼來源:factory.go

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


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