当前位置: 首页>>代码示例>>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;未经允许,请勿转载。