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


Golang extensions.Ingress類代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/pkg/apis/extensions.Ingress的典型用法代碼示例。如果您正苦於以下問題:Golang Ingress類的具體用法?Golang Ingress怎麽用?Golang Ingress使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Ingress類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ParseAnnotations

// ParseAnnotations parses the annotations contained in the ingress
// rule used to configure upstream check parameters
func ParseAnnotations(cfg defaults.Backend, ing *extensions.Ingress) *Configuration {
	if ing == nil || ing.GetAnnotations() == nil {
		return &Configuration{
			cfg.ProxyConnectTimeout,
			cfg.ProxySendTimeout,
			cfg.ProxyReadTimeout,
			cfg.ProxyBufferSize,
		}
	}

	ct, err := parser.GetIntAnnotation(connect, ing)
	if err != nil {
		ct = cfg.ProxyConnectTimeout
	}

	st, err := parser.GetIntAnnotation(send, ing)
	if err != nil {
		st = cfg.ProxySendTimeout
	}

	rt, err := parser.GetIntAnnotation(read, ing)
	if err != nil {
		rt = cfg.ProxyReadTimeout
	}

	bs, err := parser.GetStringAnnotation(bufferSize, ing)
	if err != nil || bs == "" {
		bs = cfg.ProxyBufferSize
	}

	return &Configuration{ct, st, rt, bs}
}
開發者ID:aledbf,項目名稱:Ingress,代碼行數:34,代碼來源:main.go

示例2: ParseAnnotations

// ParseAnnotations parses the annotations contained in the ingress
// rule used to indicate if the upstream servers should use SSL
func ParseAnnotations(ing *extensions.Ingress) (bool, error) {
	if ing.GetAnnotations() == nil {
		return false, errors.New("no annotations present")
	}

	return ingAnnotations(ing.GetAnnotations()).secureUpstream(), nil
}
開發者ID:raggi,項目名稱:contrib,代碼行數:9,代碼來源:main.go

示例3: ParseAnnotations

// ParseAnnotations parses the annotations contained in the ingress
// rule used to rewrite the defined paths
func ParseAnnotations(ing *extensions.Ingress) (*RateLimit, error) {
	if ing.GetAnnotations() == nil {
		return &RateLimit{}, ErrMissingAnnotations
	}

	rps := ingAnnotations(ing.GetAnnotations()).limitRPS()
	conn := ingAnnotations(ing.GetAnnotations()).limitIP()

	if rps == 0 && conn == 0 {
		return &RateLimit{
			Connections: Zone{},
			RPS:         Zone{},
		}, ErrInvalidRateLimit
	}

	zoneName := fmt.Sprintf("%v_%v", ing.GetNamespace(), ing.GetName())

	return &RateLimit{
		Connections: Zone{
			Name:       fmt.Sprintf("%v_conn", zoneName),
			Limit:      conn,
			Burst:      conn * defBurst,
			SharedSize: defSharedSize,
		},
		RPS: Zone{
			Name:       fmt.Sprintf("%v_rps", zoneName),
			Limit:      rps,
			Burst:      conn * defBurst,
			SharedSize: defSharedSize,
		},
	}, nil
}
開發者ID:spxtr,項目名稱:contrib,代碼行數:34,代碼來源:main.go

示例4: GetIntAnnotation

// GetIntAnnotation ...
func GetIntAnnotation(name string, ing *extensions.Ingress) (int, error) {
	if ing == nil || ing.GetAnnotations() == nil {
		return 0, ErrMissingAnnotations
	}
	if name == "" {
		return 0, ErrInvalidName
	}

	return ingAnnotations(ing.GetAnnotations()).parseInt(name)
}
開發者ID:aledbf,項目名稱:Ingress,代碼行數:11,代碼來源:main.go

示例5: GetBoolAnnotation

// GetBoolAnnotation ...
func GetBoolAnnotation(name string, ing *extensions.Ingress) (bool, error) {
	if ing == nil || ing.GetAnnotations() == nil {
		return false, ErrMissingAnnotations
	}
	if name == "" {
		return false, ErrInvalidName
	}

	return ingAnnotations(ing.GetAnnotations()).parseBool(name)
}
開發者ID:aledbf,項目名稱:Ingress,代碼行數:11,代碼來源:main.go


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