代码拉取完成,页面将自动刷新
package kubernetes
import (
"net/http"
"strings"
"github.com/containous/traefik/log"
"github.com/containous/traefik/types"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
)
func getBoolAnnotation(meta *v1beta1.Ingress, name string, defaultValue bool) bool {
annotationValue := defaultValue
annotationStringValue, ok := meta.Annotations[name]
switch {
case !ok:
// No op.
case annotationStringValue == "false":
annotationValue = false
case annotationStringValue == "true":
annotationValue = true
default:
log.Warnf("Unknown value %q for %q, falling back to %v", annotationStringValue, name, defaultValue)
}
return annotationValue
}
func getStringAnnotation(meta *v1beta1.Ingress, name string) string {
value := meta.Annotations[name]
return value
}
func getSliceAnnotation(meta *v1beta1.Ingress, name string) []string {
var value []string
if annotation, ok := meta.Annotations[name]; ok && annotation != "" {
value = types.SplitAndTrimString(annotation)
}
if len(value) == 0 {
log.Debugf("Could not load %v annotation, skipping...", name)
return nil
}
return value
}
func getMapAnnotation(meta *v1beta1.Ingress, annotName string) map[string]string {
if values, ok := meta.Annotations[annotName]; ok {
if len(values) == 0 {
log.Errorf("Missing value for annotation %q", annotName)
return nil
}
mapValue := make(map[string]string)
for _, parts := range strings.Split(values, "||") {
pair := strings.SplitN(parts, ":", 2)
if len(pair) != 2 {
log.Warnf("Could not load %q: %v, skipping...", annotName, pair)
} else {
mapValue[http.CanonicalHeaderKey(strings.TrimSpace(pair[0]))] = strings.TrimSpace(pair[1])
}
}
if len(mapValue) == 0 {
log.Errorf("Could not load %q, skipping...", annotName)
return nil
}
return mapValue
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。