Use prefix for sticky and stickiness tags.

This commit is contained in:
Ludovic Fernandez 2018-01-02 09:44:02 +01:00 committed by Traefiker
parent 9a7821b8fa
commit 75533b2beb
2 changed files with 70 additions and 67 deletions

View file

@ -430,7 +430,7 @@ func (p *CatalogProvider) getBasicAuth(tags []string) []string {
} }
func (p *CatalogProvider) getSticky(tags []string) string { func (p *CatalogProvider) getSticky(tags []string) string {
stickyTag := p.getTag(types.LabelBackendLoadbalancerSticky, tags, "") stickyTag := p.getAttribute(types.SuffixBackendLoadBalancerSticky, tags, "")
if len(stickyTag) > 0 { if len(stickyTag) > 0 {
log.Warnf("Deprecated configuration found: %s. Please use %s.", types.LabelBackendLoadbalancerSticky, types.LabelBackendLoadbalancerStickiness) log.Warnf("Deprecated configuration found: %s. Please use %s.", types.LabelBackendLoadbalancerSticky, types.LabelBackendLoadbalancerStickiness)
} else { } else {
@ -440,12 +440,12 @@ func (p *CatalogProvider) getSticky(tags []string) string {
} }
func (p *CatalogProvider) hasStickinessLabel(tags []string) bool { func (p *CatalogProvider) hasStickinessLabel(tags []string) bool {
stickinessTag := p.getTag(types.LabelBackendLoadbalancerStickiness, tags, "") stickinessTag := p.getAttribute(types.SuffixBackendLoadBalancerStickiness, tags, "")
return len(stickinessTag) > 0 && strings.EqualFold(strings.TrimSpace(stickinessTag), "true") return len(stickinessTag) > 0 && strings.EqualFold(strings.TrimSpace(stickinessTag), "true")
} }
func (p *CatalogProvider) getStickinessCookieName(tags []string) string { func (p *CatalogProvider) getStickinessCookieName(tags []string) string {
return p.getTag(types.LabelBackendLoadbalancerStickinessCookieName, tags, "") return p.getAttribute(types.SuffixBackendLoadBalancerStickinessCookieName, tags, "")
} }
func (p *CatalogProvider) getAttribute(name string, tags []string, defaultValue string) string { func (p *CatalogProvider) getAttribute(name string, tags []string, defaultValue string) string {

View file

@ -17,6 +17,9 @@ const (
SuffixFrontendRedirectRegex = "frontend.redirect.regex" SuffixFrontendRedirectRegex = "frontend.redirect.regex"
SuffixFrontendRedirectReplacement = "frontend.redirect.replacement" SuffixFrontendRedirectReplacement = "frontend.redirect.replacement"
SuffixFrontendRule = "frontend.rule" SuffixFrontendRule = "frontend.rule"
SuffixBackendLoadBalancerSticky = "backend.loadbalancer.sticky"
SuffixBackendLoadBalancerStickiness = "backend.loadbalancer.stickiness"
SuffixBackendLoadBalancerStickinessCookieName = "backend.loadbalancer.stickiness.cookieName"
LabelDomain = LabelPrefix + "domain" LabelDomain = LabelPrefix + "domain"
LabelEnable = LabelPrefix + "enable" LabelEnable = LabelPrefix + "enable"
LabelPort = LabelPrefix + SuffixPort LabelPort = LabelPrefix + SuffixPort
@ -63,9 +66,9 @@ const (
LabelBackendHealthcheckPath = LabelPrefix + "backend.healthcheck.path" LabelBackendHealthcheckPath = LabelPrefix + "backend.healthcheck.path"
LabelBackendHealthcheckInterval = LabelPrefix + "backend.healthcheck.interval" LabelBackendHealthcheckInterval = LabelPrefix + "backend.healthcheck.interval"
LabelBackendLoadbalancerMethod = LabelPrefix + "backend.loadbalancer.method" LabelBackendLoadbalancerMethod = LabelPrefix + "backend.loadbalancer.method"
LabelBackendLoadbalancerSticky = LabelPrefix + "backend.loadbalancer.sticky" LabelBackendLoadbalancerSticky = LabelPrefix + SuffixBackendLoadBalancerSticky
LabelBackendLoadbalancerStickiness = LabelPrefix + "backend.loadbalancer.stickiness" LabelBackendLoadbalancerStickiness = LabelPrefix + SuffixBackendLoadBalancerStickiness
LabelBackendLoadbalancerStickinessCookieName = LabelPrefix + "backend.loadbalancer.stickiness.cookieName" LabelBackendLoadbalancerStickinessCookieName = LabelPrefix + SuffixBackendLoadBalancerStickinessCookieName
LabelBackendMaxconnAmount = LabelPrefix + "backend.maxconn.amount" LabelBackendMaxconnAmount = LabelPrefix + "backend.maxconn.amount"
LabelBackendMaxconnExtractorfunc = LabelPrefix + "backend.maxconn.extractorfunc" LabelBackendMaxconnExtractorfunc = LabelPrefix + "backend.maxconn.extractorfunc"
) )