label

package
v1.6.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWeight                                  = "0" // TODO [breaking] use int value
	DefaultWeightInt                               = 0   // TODO rename to DefaultWeight
	DefaultProtocol                                = "http"
	DefaultPassHostHeader                          = "true" // TODO [breaking] use bool value
	DefaultPassHostHeaderBool                      = true   // TODO rename to DefaultPassHostHeader
	DefaultPassTLSCert                             = false
	DefaultFrontendPriority                        = "0" // TODO [breaking] int value
	DefaultFrontendPriorityInt                     = 0   // TODO rename to DefaultFrontendPriority
	DefaultCircuitBreakerExpression                = "NetworkErrorRatio() > 1"
	DefaultBackendLoadBalancerMethod               = "wrr"
	DefaultBackendMaxconnExtractorFunc             = "request.host"
	DefaultBackendLoadbalancerStickinessCookieName = ""
	DefaultBackendHealthCheckPort                  = 0
)

Default values

View Source
const (
	Prefix                                         = "traefik."
	SuffixBackend                                  = "backend"
	SuffixDomain                                   = "domain"
	SuffixEnable                                   = "enable"
	SuffixPort                                     = "port"
	SuffixPortIndex                                = "portIndex"
	SuffixProtocol                                 = "protocol"
	SuffixTags                                     = "tags"
	SuffixWeight                                   = "weight"
	SuffixBackendID                                = "backend.id"
	SuffixBackendCircuitBreaker                    = "backend.circuitbreaker"
	SuffixBackendCircuitBreakerExpression          = "backend.circuitbreaker.expression"
	SuffixBackendHealthCheckPath                   = "backend.healthcheck.path"
	SuffixBackendHealthCheckPort                   = "backend.healthcheck.port"
	SuffixBackendHealthCheckInterval               = "backend.healthcheck.interval"
	SuffixBackendLoadBalancer                      = "backend.loadbalancer"
	SuffixBackendLoadBalancerMethod                = SuffixBackendLoadBalancer + ".method"
	SuffixBackendLoadBalancerSticky                = SuffixBackendLoadBalancer + ".sticky"
	SuffixBackendLoadBalancerStickiness            = SuffixBackendLoadBalancer + ".stickiness"
	SuffixBackendLoadBalancerStickinessCookieName  = SuffixBackendLoadBalancer + ".stickiness.cookieName"
	SuffixBackendMaxConnAmount                     = "backend.maxconn.amount"
	SuffixBackendMaxConnExtractorFunc              = "backend.maxconn.extractorfunc"
	SuffixBackendBuffering                         = "backend.buffering"
	SuffixBackendBufferingMaxRequestBodyBytes      = SuffixBackendBuffering + ".maxRequestBodyBytes"
	SuffixBackendBufferingMemRequestBodyBytes      = SuffixBackendBuffering + ".memRequestBodyBytes"
	SuffixBackendBufferingMaxResponseBodyBytes     = SuffixBackendBuffering + ".maxResponseBodyBytes"
	SuffixBackendBufferingMemResponseBodyBytes     = SuffixBackendBuffering + ".memResponseBodyBytes"
	SuffixBackendBufferingRetryExpression          = SuffixBackendBuffering + ".retryExpression"
	SuffixFrontend                                 = "frontend"
	SuffixFrontendAuthBasic                        = "frontend.auth.basic"
	SuffixFrontendBackend                          = "frontend.backend"
	SuffixFrontendEntryPoints                      = "frontend.entryPoints"
	SuffixFrontendHeaders                          = "frontend.headers."
	SuffixFrontendRequestHeaders                   = SuffixFrontendHeaders + "customRequestHeaders"
	SuffixFrontendResponseHeaders                  = SuffixFrontendHeaders + "customResponseHeaders"
	SuffixFrontendHeadersAllowedHosts              = SuffixFrontendHeaders + "allowedHosts"
	SuffixFrontendHeadersHostsProxyHeaders         = SuffixFrontendHeaders + "hostsProxyHeaders"
	SuffixFrontendHeadersSSLRedirect               = SuffixFrontendHeaders + "SSLRedirect"
	SuffixFrontendHeadersSSLTemporaryRedirect      = SuffixFrontendHeaders + "SSLTemporaryRedirect"
	SuffixFrontendHeadersSSLHost                   = SuffixFrontendHeaders + "SSLHost"
	SuffixFrontendHeadersSSLProxyHeaders           = SuffixFrontendHeaders + "SSLProxyHeaders"
	SuffixFrontendHeadersSTSSeconds                = SuffixFrontendHeaders + "STSSeconds"
	SuffixFrontendHeadersSTSIncludeSubdomains      = SuffixFrontendHeaders + "STSIncludeSubdomains"
	SuffixFrontendHeadersSTSPreload                = SuffixFrontendHeaders + "STSPreload"
	SuffixFrontendHeadersForceSTSHeader            = SuffixFrontendHeaders + "forceSTSHeader"
	SuffixFrontendHeadersFrameDeny                 = SuffixFrontendHeaders + "frameDeny"
	SuffixFrontendHeadersCustomFrameOptionsValue   = SuffixFrontendHeaders + "customFrameOptionsValue"
	SuffixFrontendHeadersContentTypeNosniff        = SuffixFrontendHeaders + "contentTypeNosniff"
	SuffixFrontendHeadersBrowserXSSFilter          = SuffixFrontendHeaders + "browserXSSFilter"
	SuffixFrontendHeadersCustomBrowserXSSValue     = SuffixFrontendHeaders + "customBrowserXSSValue"
	SuffixFrontendHeadersContentSecurityPolicy     = SuffixFrontendHeaders + "contentSecurityPolicy"
	SuffixFrontendHeadersPublicKey                 = SuffixFrontendHeaders + "publicKey"
	SuffixFrontendHeadersReferrerPolicy            = SuffixFrontendHeaders + "referrerPolicy"
	SuffixFrontendHeadersIsDevelopment             = SuffixFrontendHeaders + "isDevelopment"
	SuffixFrontendPassHostHeader                   = "frontend.passHostHeader"
	SuffixFrontendPassTLSCert                      = "frontend.passTLSCert"
	SuffixFrontendPriority                         = "frontend.priority"
	SuffixFrontendRateLimitExtractorFunc           = "frontend.rateLimit.extractorFunc"
	SuffixFrontendRedirectEntryPoint               = "frontend.redirect.entryPoint"
	SuffixFrontendRedirectRegex                    = "frontend.redirect.regex"
	SuffixFrontendRedirectReplacement              = "frontend.redirect.replacement"
	SuffixFrontendRedirectPermanent                = "frontend.redirect.permanent"
	SuffixFrontendRule                             = "frontend.rule"
	SuffixFrontendWhitelistSourceRange             = "frontend.whitelistSourceRange" // Deprecated
	SuffixFrontendWhiteList                        = "frontend.whiteList."
	SuffixFrontendWhiteListSourceRange             = SuffixFrontendWhiteList + "sourceRange"
	SuffixFrontendWhiteListUseXForwardedFor        = SuffixFrontendWhiteList + "useXForwardedFor"
	TraefikDomain                                  = Prefix + SuffixDomain
	TraefikEnable                                  = Prefix + SuffixEnable
	TraefikPort                                    = Prefix + SuffixPort
	TraefikPortIndex                               = Prefix + SuffixPortIndex
	TraefikProtocol                                = Prefix + SuffixProtocol
	TraefikTags                                    = Prefix + SuffixTags
	TraefikWeight                                  = Prefix + SuffixWeight
	TraefikBackend                                 = Prefix + SuffixBackend
	TraefikBackendID                               = Prefix + SuffixBackendID
	TraefikBackendCircuitBreaker                   = Prefix + SuffixBackendCircuitBreaker
	TraefikBackendCircuitBreakerExpression         = Prefix + SuffixBackendCircuitBreakerExpression
	TraefikBackendHealthCheckPath                  = Prefix + SuffixBackendHealthCheckPath
	TraefikBackendHealthCheckPort                  = Prefix + SuffixBackendHealthCheckPort
	TraefikBackendHealthCheckInterval              = Prefix + SuffixBackendHealthCheckInterval
	TraefikBackendLoadBalancer                     = Prefix + SuffixBackendLoadBalancer
	TraefikBackendLoadBalancerMethod               = Prefix + SuffixBackendLoadBalancerMethod
	TraefikBackendLoadBalancerSticky               = Prefix + SuffixBackendLoadBalancerSticky
	TraefikBackendLoadBalancerStickiness           = Prefix + SuffixBackendLoadBalancerStickiness
	TraefikBackendLoadBalancerStickinessCookieName = Prefix + SuffixBackendLoadBalancerStickinessCookieName
	TraefikBackendMaxConnAmount                    = Prefix + SuffixBackendMaxConnAmount
	TraefikBackendMaxConnExtractorFunc             = Prefix + SuffixBackendMaxConnExtractorFunc
	TraefikBackendBuffering                        = Prefix + SuffixBackendBuffering
	TraefikBackendBufferingMaxRequestBodyBytes     = Prefix + SuffixBackendBufferingMaxRequestBodyBytes
	TraefikBackendBufferingMemRequestBodyBytes     = Prefix + SuffixBackendBufferingMemRequestBodyBytes
	TraefikBackendBufferingMaxResponseBodyBytes    = Prefix + SuffixBackendBufferingMaxResponseBodyBytes
	TraefikBackendBufferingMemResponseBodyBytes    = Prefix + SuffixBackendBufferingMemResponseBodyBytes
	TraefikBackendBufferingRetryExpression         = Prefix + SuffixBackendBufferingRetryExpression
	TraefikFrontend                                = Prefix + SuffixFrontend
	TraefikFrontendAuthBasic                       = Prefix + SuffixFrontendAuthBasic
	TraefikFrontendBackend                         = Prefix + SuffixFrontendBackend
	TraefikFrontendEntryPoints                     = Prefix + SuffixFrontendEntryPoints
	TraefikFrontendPassHostHeader                  = Prefix + SuffixFrontendPassHostHeader
	TraefikFrontendPassTLSCert                     = Prefix + SuffixFrontendPassTLSCert
	TraefikFrontendPriority                        = Prefix + SuffixFrontendPriority
	TraefikFrontendRateLimitExtractorFunc          = Prefix + SuffixFrontendRateLimitExtractorFunc
	TraefikFrontendRedirectEntryPoint              = Prefix + SuffixFrontendRedirectEntryPoint
	TraefikFrontendRedirectRegex                   = Prefix + SuffixFrontendRedirectRegex
	TraefikFrontendRedirectReplacement             = Prefix + SuffixFrontendRedirectReplacement
	TraefikFrontendRedirectPermanent               = Prefix + SuffixFrontendRedirectPermanent
	TraefikFrontendRule                            = Prefix + SuffixFrontendRule
	TraefikFrontendWhitelistSourceRange            = Prefix + SuffixFrontendWhitelistSourceRange // Deprecated
	TraefikFrontendWhiteListSourceRange            = Prefix + SuffixFrontendWhiteListSourceRange
	TraefikFrontendWhiteListUseXForwardedFor       = Prefix + SuffixFrontendWhiteListUseXForwardedFor
	TraefikFrontendRequestHeaders                  = Prefix + SuffixFrontendRequestHeaders
	TraefikFrontendResponseHeaders                 = Prefix + SuffixFrontendResponseHeaders
	TraefikFrontendAllowedHosts                    = Prefix + SuffixFrontendHeadersAllowedHosts
	TraefikFrontendHostsProxyHeaders               = Prefix + SuffixFrontendHeadersHostsProxyHeaders
	TraefikFrontendSSLRedirect                     = Prefix + SuffixFrontendHeadersSSLRedirect
	TraefikFrontendSSLTemporaryRedirect            = Prefix + SuffixFrontendHeadersSSLTemporaryRedirect
	TraefikFrontendSSLHost                         = Prefix + SuffixFrontendHeadersSSLHost
	TraefikFrontendSSLProxyHeaders                 = Prefix + SuffixFrontendHeadersSSLProxyHeaders
	TraefikFrontendSTSSeconds                      = Prefix + SuffixFrontendHeadersSTSSeconds
	TraefikFrontendSTSIncludeSubdomains            = Prefix + SuffixFrontendHeadersSTSIncludeSubdomains
	TraefikFrontendSTSPreload                      = Prefix + SuffixFrontendHeadersSTSPreload
	TraefikFrontendForceSTSHeader                  = Prefix + SuffixFrontendHeadersForceSTSHeader
	TraefikFrontendFrameDeny                       = Prefix + SuffixFrontendHeadersFrameDeny
	TraefikFrontendCustomFrameOptionsValue         = Prefix + SuffixFrontendHeadersCustomFrameOptionsValue
	TraefikFrontendContentTypeNosniff              = Prefix + SuffixFrontendHeadersContentTypeNosniff
	TraefikFrontendBrowserXSSFilter                = Prefix + SuffixFrontendHeadersBrowserXSSFilter
	TraefikFrontendCustomBrowserXSSValue           = Prefix + SuffixFrontendHeadersCustomBrowserXSSValue
	TraefikFrontendContentSecurityPolicy           = Prefix + SuffixFrontendHeadersContentSecurityPolicy
	TraefikFrontendPublicKey                       = Prefix + SuffixFrontendHeadersPublicKey
	TraefikFrontendReferrerPolicy                  = Prefix + SuffixFrontendHeadersReferrerPolicy
	TraefikFrontendIsDevelopment                   = Prefix + SuffixFrontendHeadersIsDevelopment
	BaseFrontendErrorPage                          = "frontend.errors."
	SuffixErrorPageBackend                         = "backend"
	SuffixErrorPageQuery                           = "query"
	SuffixErrorPageStatus                          = "status"
	BaseFrontendRateLimit                          = "frontend.rateLimit.rateSet."
	SuffixRateLimitPeriod                          = "period"
	SuffixRateLimitAverage                         = "average"
	SuffixRateLimitBurst                           = "burst"
)

Traefik labels

Variables

View Source
var (
	// RegexpBaseFrontendErrorPage used to extract error pages from service's label
	RegexpBaseFrontendErrorPage = regexp.MustCompile(`^frontend\.errors\.(?P<name>[^ .]+)\.(?P<field>[^ .]+)$`)

	// RegexpFrontendErrorPage used to extract error pages from label
	RegexpFrontendErrorPage = regexp.MustCompile(`^traefik\.frontend\.errors\.(?P<name>[^ .]+)\.(?P<field>[^ .]+)$`)

	// RegexpBaseFrontendRateLimit used to extract rate limits from service's label
	RegexpBaseFrontendRateLimit = regexp.MustCompile(`^frontend\.rateLimit\.rateSet\.(?P<name>[^ .]+)\.(?P<field>[^ .]+)$`)

	// RegexpFrontendRateLimit used to extract rate limits from label
	RegexpFrontendRateLimit = regexp.MustCompile(`^traefik\.frontend\.rateLimit\.rateSet\.(?P<name>[^ .]+)\.(?P<field>[^ .]+)$`)
)
View Source
var (
	// SegmentPropertiesRegexp used to extract the name of the segment and the name of the property for this segment
	// All properties are under the format traefik.<segment_name>.frontend.*= except the port/portIndex/weight/protocol/backend directly after traefik.<segment_name>.
	SegmentPropertiesRegexp = regexp.MustCompile(`^traefik\.(?P<segment_name>.+?)\.(?P<property_name>port|portIndex|weight|protocol|backend|frontend\.(.+))$`)

	// PortRegexp used to extract the port label of the segment
	PortRegexp = regexp.MustCompile(`^traefik\.(?P<segment_name>.+?)\.port$`)
)

Functions

func FindSegmentSubmatch

func FindSegmentSubmatch(name string) []string

FindSegmentSubmatch split segment labels

func GetBoolValue

func GetBoolValue(labels map[string]string, labelName string, defaultValue bool) bool

GetBoolValue get bool value associated to a label

func GetBuffering

func GetBuffering(labels map[string]string) *types.Buffering

GetBuffering Create buffering from labels

func GetCircuitBreaker

func GetCircuitBreaker(labels map[string]string) *types.CircuitBreaker

GetCircuitBreaker Create circuit breaker from labels

func GetErrorPages

func GetErrorPages(labels map[string]string) map[string]*types.ErrorPage

GetErrorPages Create error pages from labels

func GetFuncBool

func GetFuncBool(labelName string, defaultValue bool) func(map[string]string) bool

GetFuncBool a func related to GetBoolValue

func GetFuncInt

func GetFuncInt(labelName string, defaultValue int) func(map[string]string) int

GetFuncInt a func related to GetIntValue

func GetFuncSliceString

func GetFuncSliceString(labelName string) func(map[string]string) []string

GetFuncSliceString a func related to GetSliceStringValue

func GetFuncString

func GetFuncString(labelName string, defaultValue string) func(map[string]string) string

GetFuncString a func related to GetStringValue

func GetHeaders

func GetHeaders(labels map[string]string) *types.Headers

GetHeaders Create headers from labels

func GetHealthCheck

func GetHealthCheck(labels map[string]string) *types.HealthCheck

GetHealthCheck Create health check from labels

func GetInt64Value

func GetInt64Value(labels map[string]string, labelName string, defaultValue int64) int64

GetInt64Value get int64 value associated to a label

func GetIntValue

func GetIntValue(labels map[string]string, labelName string, defaultValue int) int

GetIntValue get int value associated to a label

func GetLoadBalancer

func GetLoadBalancer(labels map[string]string) *types.LoadBalancer

GetLoadBalancer Create load balancer from labels

func GetMapValue

func GetMapValue(labels map[string]string, labelName string) map[string]string

GetMapValue get Map value associated to a label

func GetMaxConn

func GetMaxConn(labels map[string]string) *types.MaxConn

GetMaxConn Create max connection from labels

func GetRateLimit

func GetRateLimit(labels map[string]string) *types.RateLimit

GetRateLimit Create rate limits from labels

func GetRedirect

func GetRedirect(labels map[string]string) *types.Redirect

GetRedirect Create redirect from labels

func GetServiceLabel

func GetServiceLabel(labelName, serviceName string) string

GetServiceLabel converts a key value of Label*, given a serviceName, into a pattern <LabelPrefix>.<serviceName>.<property> i.e. For LabelFrontendRule and serviceName=app it will return "traefik.app.frontend.rule" Deprecated

func GetSliceStringValue

func GetSliceStringValue(labels map[string]string, labelName string) []string

GetSliceStringValue get a slice of string associated to a label

func GetStringMultipleStrict

func GetStringMultipleStrict(labels map[string]string, labelNames ...string) (map[string]string, error)

GetStringMultipleStrict get multiple string values associated to several labels Fail if one label is missing

func GetStringValue

func GetStringValue(labels map[string]string, labelName string, defaultValue string) string

GetStringValue get string value associated to a label

func GetWhiteList

func GetWhiteList(labels map[string]string) *types.WhiteList

GetWhiteList Create white list from labels

func Has

func Has(labels map[string]string, labelName string) bool

Has Check if a value is associated to a label

func HasPrefix

func HasPrefix(labels map[string]string, prefix string) bool

HasPrefix Check if a value is associated to a less one label with a prefix

func IsEnabled

func IsEnabled(labels map[string]string, exposedByDefault bool) bool

IsEnabled Check if a container is enabled in Træfik

func ParseErrorPages

func ParseErrorPages(labels map[string]string, labelPrefix string, labelRegex *regexp.Regexp) map[string]*types.ErrorPage

ParseErrorPages parse error pages to create ErrorPage struct

func ParseMapValue

func ParseMapValue(labelName, values string) map[string]string

ParseMapValue get Map value for a label value

func ParseRateSets

func ParseRateSets(labels map[string]string, labelPrefix string, labelRegex *regexp.Regexp) map[string]*types.Rate

ParseRateSets parse rate limits to create Rate struct

func SplitAndTrimString

func SplitAndTrimString(base string, sep string) []string

SplitAndTrimString splits separatedString at the separator character and trims each piece, filtering out empty pieces. Returns the list of pieces or nil if the input did not contain a non-empty piece.

Types

type SegmentProperties

type SegmentProperties map[string]SegmentPropertyValues

SegmentProperties is a map of segment properties per segment, which we can get with label[segmentName][propertyName]. It yields a property value.

func ExtractServiceProperties

func ExtractServiceProperties(labels map[string]string) SegmentProperties

ExtractServiceProperties Extract services labels Deprecated

func ExtractServicePropertiesP

func ExtractServicePropertiesP(labels *map[string]string) SegmentProperties

ExtractServicePropertiesP Extract services labels Deprecated

func ExtractTraefikLabels

func ExtractTraefikLabels(originLabels map[string]string) SegmentProperties

ExtractTraefikLabels transform labels to segment labels

func (SegmentProperties) GetSegmentNames

func (s SegmentProperties) GetSegmentNames() []string

GetSegmentNames get all segment names

type SegmentPropertyValues

type SegmentPropertyValues map[string]string

SegmentPropertyValues is a map of segment properties an example value is: weight=42

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL