Factorize labels
* refactor(accesslog): factorize file name. * traefik.frontend.rule * traefik.frontend.value * traefik.backend.circuitbreaker.expression * traefik.enable * traefik.backend.loadbalancer.method * traefik.backend.loadbalancer.sticky * traefik.backend.maxconn.amount * traefik.backend.maxconn.extractorfunc * traefik.port * traefik.tags * traefik.backend * traefik.weight * traefik.domain * traefik.protocol * traefik.frontend.passHostHeader * traefik.frontend.whitelistSourceRange * traefik.frontend.priority * traefik.frontend.entryPoints * traefik.frontend.auth.basic * traefik.backend.id * traefik.backend.circuitbreaker * traefik.frontend.rule.type * traefik.portIndex * refactor(docker): specific labels * refactor(rancher): specific labels * traefik.backend.healthcheck.* * refactor(providers): factorize labels.
This commit is contained in:
parent
2e84b1e556
commit
d653a348b1
20 changed files with 390 additions and 330 deletions
|
@ -25,11 +25,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
labelPort = "traefik.port"
|
||||
labelPortIndex = "traefik.portIndex"
|
||||
labelBackendHealthCheckPath = "traefik.backend.healthcheck.path"
|
||||
labelBackendHealthCheckInterval = "traefik.backend.healthcheck.interval"
|
||||
traceMaxScanTokenSize = 1024 * 1024
|
||||
traceMaxScanTokenSize = 1024 * 1024
|
||||
)
|
||||
|
||||
var _ provider.Provider = (*Provider)(nil)
|
||||
|
@ -222,15 +218,15 @@ func (p *Provider) taskFilter(task marathon.Task, applications *marathon.Applica
|
|||
}
|
||||
|
||||
// Filter illegal port label specification.
|
||||
_, hasPortIndexLabel := p.getLabel(application, labelPortIndex)
|
||||
_, hasPortLabel := p.getLabel(application, labelPort)
|
||||
_, hasPortIndexLabel := p.getLabel(application, types.LabelPortIndex)
|
||||
_, hasPortLabel := p.getLabel(application, types.LabelPort)
|
||||
if hasPortIndexLabel && hasPortLabel {
|
||||
log.Debugf("Filtering Marathon task %s from application %s specifying both traefik.portIndex and traefik.port labels", task.ID, application.ID)
|
||||
return false
|
||||
}
|
||||
|
||||
// Filter by constraints.
|
||||
label, _ := p.getLabel(application, "traefik.tags")
|
||||
label, _ := p.getLabel(application, types.LabelTags)
|
||||
constraintTags := strings.Split(label, ",")
|
||||
if p.MarathonLBCompatibility {
|
||||
if label, ok := p.getLabel(application, "HAPROXY_GROUP"); ok {
|
||||
|
@ -266,7 +262,7 @@ func (p *Provider) taskFilter(task marathon.Task, applications *marathon.Applica
|
|||
}
|
||||
|
||||
func (p *Provider) applicationFilter(app marathon.Application, filteredTasks []marathon.Task) bool {
|
||||
label, _ := p.getLabel(app, "traefik.tags")
|
||||
label, _ := p.getLabel(app, types.LabelTags)
|
||||
constraintTags := strings.Split(label, ",")
|
||||
if p.MarathonLBCompatibility {
|
||||
if label, ok := p.getLabel(app, "HAPROXY_GROUP"); ok {
|
||||
|
@ -295,7 +291,7 @@ func getApplication(task marathon.Task, apps []marathon.Application) (marathon.A
|
|||
}
|
||||
|
||||
func isApplicationEnabled(application marathon.Application, exposedByDefault bool) bool {
|
||||
return exposedByDefault && (*application.Labels)["traefik.enable"] != "false" || (*application.Labels)["traefik.enable"] == "true"
|
||||
return exposedByDefault && (*application.Labels)[types.LabelEnable] != "false" || (*application.Labels)[types.LabelEnable] == "true"
|
||||
}
|
||||
|
||||
func (p *Provider) getLabel(application marathon.Application, label string) (string, bool) {
|
||||
|
@ -328,14 +324,14 @@ func (p *Provider) getWeight(task marathon.Task, applications []marathon.Applica
|
|||
log.Errorf("Unable to get marathon application from task %s", task.AppID)
|
||||
return "0"
|
||||
}
|
||||
if label, ok := p.getLabel(application, "traefik.weight"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelWeight); ok {
|
||||
return label
|
||||
}
|
||||
return "0"
|
||||
}
|
||||
|
||||
func (p *Provider) getDomain(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, "traefik.domain"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelDomain); ok {
|
||||
return label
|
||||
}
|
||||
return p.Domain
|
||||
|
@ -347,35 +343,35 @@ func (p *Provider) getProtocol(task marathon.Task, applications []marathon.Appli
|
|||
log.Errorf("Unable to get marathon application from task %s", task.AppID)
|
||||
return "http"
|
||||
}
|
||||
if label, ok := p.getLabel(application, "traefik.protocol"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelProtocol); ok {
|
||||
return label
|
||||
}
|
||||
return "http"
|
||||
}
|
||||
|
||||
func (p *Provider) getSticky(application marathon.Application) string {
|
||||
if sticky, ok := p.getLabel(application, "traefik.backend.loadbalancer.sticky"); ok {
|
||||
if sticky, ok := p.getLabel(application, types.LabelBackendLoadbalancerSticky); ok {
|
||||
return sticky
|
||||
}
|
||||
return "false"
|
||||
}
|
||||
|
||||
func (p *Provider) getPassHostHeader(application marathon.Application) string {
|
||||
if passHostHeader, ok := p.getLabel(application, "traefik.frontend.passHostHeader"); ok {
|
||||
if passHostHeader, ok := p.getLabel(application, types.LabelFrontendPassHostHeader); ok {
|
||||
return passHostHeader
|
||||
}
|
||||
return "true"
|
||||
}
|
||||
|
||||
func (p *Provider) getPriority(application marathon.Application) string {
|
||||
if priority, ok := p.getLabel(application, "traefik.frontend.priority"); ok {
|
||||
if priority, ok := p.getLabel(application, types.LabelFrontendPriority); ok {
|
||||
return priority
|
||||
}
|
||||
return "0"
|
||||
}
|
||||
|
||||
func (p *Provider) getEntryPoints(application marathon.Application) []string {
|
||||
if entryPoints, ok := p.getLabel(application, "traefik.frontend.entryPoints"); ok {
|
||||
if entryPoints, ok := p.getLabel(application, types.LabelFrontendEntryPoints); ok {
|
||||
return strings.Split(entryPoints, ",")
|
||||
}
|
||||
return []string{}
|
||||
|
@ -384,7 +380,7 @@ func (p *Provider) getEntryPoints(application marathon.Application) []string {
|
|||
// getFrontendRule returns the frontend rule for the specified application, using
|
||||
// it's label. It returns a default one (Host) if the label is not present.
|
||||
func (p *Provider) getFrontendRule(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, "traefik.frontend.rule"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelFrontendRule); ok {
|
||||
return label
|
||||
}
|
||||
if p.MarathonLBCompatibility {
|
||||
|
@ -405,7 +401,7 @@ func (p *Provider) getBackend(task marathon.Task, applications []marathon.Applic
|
|||
}
|
||||
|
||||
func (p *Provider) getFrontendBackend(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, "traefik.backend"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackend); ok {
|
||||
return label
|
||||
}
|
||||
return provider.Replace("/", "-", application.ID)
|
||||
|
@ -422,26 +418,26 @@ func (p *Provider) getSubDomain(name string) string {
|
|||
}
|
||||
|
||||
func (p *Provider) hasCircuitBreakerLabels(application marathon.Application) bool {
|
||||
_, ok := p.getLabel(application, "traefik.backend.circuitbreaker.expression")
|
||||
_, ok := p.getLabel(application, types.LabelBackendCircuitbreakerExpression)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (p *Provider) hasLoadBalancerLabels(application marathon.Application) bool {
|
||||
_, errMethod := p.getLabel(application, "traefik.backend.loadbalancer.method")
|
||||
_, errSticky := p.getLabel(application, "traefik.backend.loadbalancer.sticky")
|
||||
_, errMethod := p.getLabel(application, types.LabelBackendLoadbalancerMethod)
|
||||
_, errSticky := p.getLabel(application, types.LabelBackendLoadbalancerSticky)
|
||||
return errMethod || errSticky
|
||||
}
|
||||
|
||||
func (p *Provider) hasMaxConnLabels(application marathon.Application) bool {
|
||||
if _, ok := p.getLabel(application, "traefik.backend.maxconn.amount"); !ok {
|
||||
if _, ok := p.getLabel(application, types.LabelBackendMaxconnAmount); !ok {
|
||||
return false
|
||||
}
|
||||
_, ok := p.getLabel(application, "traefik.backend.maxconn.extractorfunc")
|
||||
_, ok := p.getLabel(application, types.LabelBackendMaxconnExtractorfunc)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (p *Provider) getMaxConnAmount(application marathon.Application) int64 {
|
||||
if label, ok := p.getLabel(application, "traefik.backend.maxconn.amount"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackendMaxconnAmount); ok {
|
||||
i, errConv := strconv.ParseInt(label, 10, 64)
|
||||
if errConv != nil {
|
||||
log.Errorf("Unable to parse traefik.backend.maxconn.amount %s", label)
|
||||
|
@ -453,21 +449,21 @@ func (p *Provider) getMaxConnAmount(application marathon.Application) int64 {
|
|||
}
|
||||
|
||||
func (p *Provider) getMaxConnExtractorFunc(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, "traefik.backend.maxconn.extractorfunc"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackendMaxconnExtractorfunc); ok {
|
||||
return label
|
||||
}
|
||||
return "request.host"
|
||||
}
|
||||
|
||||
func (p *Provider) getLoadBalancerMethod(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, "traefik.backend.loadbalancer.method"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackendLoadbalancerMethod); ok {
|
||||
return label
|
||||
}
|
||||
return "wrr"
|
||||
}
|
||||
|
||||
func (p *Provider) getCircuitBreakerExpression(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, "traefik.backend.circuitbreaker.expression"); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackendCircuitbreakerExpression); ok {
|
||||
return label
|
||||
}
|
||||
return "NetworkErrorRatio() > 1"
|
||||
|
@ -478,21 +474,21 @@ func (p *Provider) hasHealthCheckLabels(application marathon.Application) bool {
|
|||
}
|
||||
|
||||
func (p *Provider) getHealthCheckPath(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, labelBackendHealthCheckPath); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackendHealthcheckPath); ok {
|
||||
return label
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (p *Provider) getHealthCheckInterval(application marathon.Application) string {
|
||||
if label, ok := p.getLabel(application, labelBackendHealthCheckInterval); ok {
|
||||
if label, ok := p.getLabel(application, types.LabelBackendHealthcheckInterval); ok {
|
||||
return label
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (p *Provider) getBasicAuth(application marathon.Application) []string {
|
||||
if basicAuth, ok := p.getLabel(application, "traefik.frontend.auth.basic"); ok {
|
||||
if basicAuth, ok := p.getLabel(application, types.LabelFrontendAuthBasic); ok {
|
||||
return strings.Split(basicAuth, ",")
|
||||
}
|
||||
|
||||
|
@ -500,7 +496,7 @@ func (p *Provider) getBasicAuth(application marathon.Application) []string {
|
|||
}
|
||||
|
||||
func processPorts(application marathon.Application, task marathon.Task) (int, error) {
|
||||
if portLabel, ok := (*application.Labels)[labelPort]; ok {
|
||||
if portLabel, ok := (*application.Labels)[types.LabelPort]; ok {
|
||||
port, err := strconv.Atoi(portLabel)
|
||||
switch {
|
||||
case err != nil:
|
||||
|
@ -517,7 +513,7 @@ func processPorts(application marathon.Application, task marathon.Task) (int, er
|
|||
}
|
||||
|
||||
portIndex := 0
|
||||
portIndexLabel, ok := (*application.Labels)[labelPortIndex]
|
||||
portIndexLabel, ok := (*application.Labels)[types.LabelPortIndex]
|
||||
if ok {
|
||||
var err error
|
||||
portIndex, err = parseIndex(portIndexLabel, len(ports))
|
||||
|
|
|
@ -126,8 +126,8 @@ func TestMarathonLoadConfig(t *testing.T) {
|
|||
ID: "/testLoadBalancerAndCircuitBreaker.dot",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.backend.loadbalancer.method": "drr",
|
||||
"traefik.backend.circuitbreaker.expression": "NetworkErrorRatio() > 0.5",
|
||||
types.LabelBackendLoadbalancerMethod: "drr",
|
||||
types.LabelBackendCircuitbreakerExpression: "NetworkErrorRatio() > 0.5",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -185,8 +185,8 @@ func TestMarathonLoadConfig(t *testing.T) {
|
|||
ID: "/testMaxConn",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.backend.maxconn.amount": "1000",
|
||||
"traefik.backend.maxconn.extractorfunc": "client.ip",
|
||||
types.LabelBackendMaxconnAmount: "1000",
|
||||
types.LabelBackendMaxconnExtractorfunc: "client.ip",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -242,7 +242,7 @@ func TestMarathonLoadConfig(t *testing.T) {
|
|||
ID: "/testMaxConnOnlySpecifyAmount",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.backend.maxconn.amount": "1000",
|
||||
types.LabelBackendMaxconnAmount: "1000",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -295,7 +295,7 @@ func TestMarathonLoadConfig(t *testing.T) {
|
|||
ID: "/testMaxConnOnlyExtractorFunc",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.backend.maxconn.extractorfunc": "client.ip",
|
||||
types.LabelBackendMaxconnExtractorfunc: "client.ip",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -348,8 +348,8 @@ func TestMarathonLoadConfig(t *testing.T) {
|
|||
ID: "/testHealthCheck",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
labelBackendHealthCheckPath: "/path",
|
||||
labelBackendHealthCheckInterval: "5m",
|
||||
types.LabelBackendHealthcheckPath: "/path",
|
||||
types.LabelBackendHealthcheckInterval: "5m",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -513,7 +513,7 @@ func TestMarathonTaskFilter(t *testing.T) {
|
|||
ID: "disable",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.enable": "false",
|
||||
types.LabelEnable: "false",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -532,8 +532,8 @@ func TestMarathonTaskFilter(t *testing.T) {
|
|||
ID: "specify-both-port-index-and-number",
|
||||
Ports: []int{80, 443},
|
||||
Labels: &map[string]string{
|
||||
"traefik.port": "443",
|
||||
"traefik.portIndex": "1",
|
||||
types.LabelPort: "443",
|
||||
types.LabelPortIndex: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -667,7 +667,7 @@ func TestMarathonTaskFilter(t *testing.T) {
|
|||
ID: "disable-default-expose-disable-in-label",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.enable": "false",
|
||||
types.LabelEnable: "false",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -686,7 +686,7 @@ func TestMarathonTaskFilter(t *testing.T) {
|
|||
ID: "disable-default-expose-enable-in-label",
|
||||
Ports: []int{80},
|
||||
Labels: &map[string]string{
|
||||
"traefik.enable": "true",
|
||||
types.LabelEnable: "true",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -729,7 +729,7 @@ func TestMarathonAppConstraints(t *testing.T) {
|
|||
application: marathon.Application{
|
||||
ID: "foo2",
|
||||
Labels: &map[string]string{
|
||||
"traefik.tags": "valid",
|
||||
types.LabelTags: "valid",
|
||||
},
|
||||
},
|
||||
filteredTasks: []marathon.Task{
|
||||
|
@ -745,7 +745,7 @@ func TestMarathonAppConstraints(t *testing.T) {
|
|||
ID: "foo3",
|
||||
Labels: &map[string]string{
|
||||
"HAPROXY_GROUP": "valid",
|
||||
"traefik.tags": "notvalid",
|
||||
types.LabelTags: "notvalid",
|
||||
},
|
||||
},
|
||||
filteredTasks: []marathon.Task{
|
||||
|
@ -786,7 +786,7 @@ func TestMarathonTaskConstraints(t *testing.T) {
|
|||
}, {
|
||||
ID: "foo1",
|
||||
Labels: &map[string]string{
|
||||
"traefik.tags": "other",
|
||||
types.LabelTags: "other",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -802,7 +802,7 @@ func TestMarathonTaskConstraints(t *testing.T) {
|
|||
{
|
||||
ID: "foo2",
|
||||
Labels: &map[string]string{
|
||||
"traefik.tags": "valid",
|
||||
types.LabelTags: "valid",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -819,13 +819,13 @@ func TestMarathonTaskConstraints(t *testing.T) {
|
|||
ID: "foo3",
|
||||
Labels: &map[string]string{
|
||||
"HAPROXY_GROUP": "valid",
|
||||
"traefik.tags": "notvalid",
|
||||
types.LabelTags: "notvalid",
|
||||
},
|
||||
}, {
|
||||
ID: "foo4",
|
||||
Labels: &map[string]string{
|
||||
"HAPROXY_GROUP": "notvalid",
|
||||
"traefik.tags": "valid",
|
||||
types.LabelTags: "valid",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -961,7 +961,7 @@ func TestMarathonGetPort(t *testing.T) {
|
|||
{
|
||||
ID: "app",
|
||||
Labels: &map[string]string{
|
||||
"traefik.port": "80",
|
||||
types.LabelPort: "80",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -977,7 +977,7 @@ func TestMarathonGetPort(t *testing.T) {
|
|||
{
|
||||
ID: "app",
|
||||
Labels: &map[string]string{
|
||||
"traefik.port": "foobar",
|
||||
types.LabelPort: "foobar",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -993,7 +993,7 @@ func TestMarathonGetPort(t *testing.T) {
|
|||
{
|
||||
ID: "app",
|
||||
Labels: &map[string]string{
|
||||
"traefik.port": "-1",
|
||||
types.LabelPort: "-1",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1102,7 +1102,7 @@ func TestMarathonGetPort(t *testing.T) {
|
|||
{
|
||||
ID: "app",
|
||||
Labels: &map[string]string{
|
||||
"traefik.portIndex": "1",
|
||||
types.LabelPortIndex: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1118,7 +1118,7 @@ func TestMarathonGetPort(t *testing.T) {
|
|||
{
|
||||
ID: "app",
|
||||
Labels: &map[string]string{
|
||||
"traefik.portIndex": "foobar",
|
||||
types.LabelPortIndex: "foobar",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1175,7 +1175,7 @@ func TestMarathonGetWeight(t *testing.T) {
|
|||
{
|
||||
ID: "test1",
|
||||
Labels: &map[string]string{
|
||||
"traefik.weight": "10",
|
||||
types.LabelWeight: "10",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1203,7 +1203,7 @@ func TestMarathonGetWeight(t *testing.T) {
|
|||
{
|
||||
ID: "test",
|
||||
Labels: &map[string]string{
|
||||
"traefik.weight": "10",
|
||||
types.LabelWeight: "10",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1239,7 +1239,7 @@ func TestMarathonGetDomain(t *testing.T) {
|
|||
{
|
||||
application: marathon.Application{
|
||||
Labels: &map[string]string{
|
||||
"traefik.domain": "foo.bar",
|
||||
types.LabelDomain: "foo.bar",
|
||||
},
|
||||
},
|
||||
expected: "foo.bar",
|
||||
|
@ -1272,7 +1272,7 @@ func TestMarathonGetProtocol(t *testing.T) {
|
|||
{
|
||||
ID: "test1",
|
||||
Labels: &map[string]string{
|
||||
"traefik.protocol": "https",
|
||||
types.LabelProtocol: "https",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1300,7 +1300,7 @@ func TestMarathonGetProtocol(t *testing.T) {
|
|||
{
|
||||
ID: "test",
|
||||
Labels: &map[string]string{
|
||||
"traefik.protocol": "https",
|
||||
types.LabelProtocol: "https",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1334,7 +1334,7 @@ func TestMarathonGetPassHostHeader(t *testing.T) {
|
|||
{
|
||||
application: marathon.Application{
|
||||
Labels: &map[string]string{
|
||||
"traefik.frontend.passHostHeader": "false",
|
||||
types.LabelFrontendPassHostHeader: "false",
|
||||
},
|
||||
},
|
||||
expected: "false",
|
||||
|
@ -1364,7 +1364,7 @@ func TestMarathonGetEntryPoints(t *testing.T) {
|
|||
{
|
||||
application: marathon.Application{
|
||||
Labels: &map[string]string{
|
||||
"traefik.frontend.entryPoints": "http,https",
|
||||
types.LabelFrontendEntryPoints: "http,https",
|
||||
},
|
||||
},
|
||||
expected: []string{"http", "https"},
|
||||
|
@ -1405,7 +1405,7 @@ func TestMarathonGetFrontendRule(t *testing.T) {
|
|||
{
|
||||
application: marathon.Application{
|
||||
Labels: &map[string]string{
|
||||
"traefik.frontend.rule": "Host:foo.bar",
|
||||
types.LabelFrontendRule: "Host:foo.bar",
|
||||
"HAPROXY_0_VHOST": "notvalid",
|
||||
},
|
||||
},
|
||||
|
@ -1446,7 +1446,7 @@ func TestMarathonGetBackend(t *testing.T) {
|
|||
application: marathon.Application{
|
||||
ID: "foo",
|
||||
Labels: &map[string]string{
|
||||
"traefik.backend": "bar",
|
||||
types.LabelBackend: "bar",
|
||||
},
|
||||
},
|
||||
expected: "bar",
|
||||
|
@ -1522,7 +1522,7 @@ func TestMarathonHasHealthCheckLabels(t *testing.T) {
|
|||
Labels: &map[string]string{},
|
||||
}
|
||||
if test.value != nil {
|
||||
app.AddLabel(labelBackendHealthCheckPath, *test.value)
|
||||
app.AddLabel(types.LabelBackendHealthcheckPath, *test.value)
|
||||
}
|
||||
prov := &Provider{}
|
||||
got := prov.hasHealthCheckLabels(app)
|
||||
|
@ -1558,7 +1558,7 @@ func TestMarathonGetHealthCheckPath(t *testing.T) {
|
|||
app := marathon.Application{}
|
||||
app.EmptyLabels()
|
||||
if test.value != nil {
|
||||
app.AddLabel(labelBackendHealthCheckPath, *test.value)
|
||||
app.AddLabel(types.LabelBackendHealthcheckPath, *test.value)
|
||||
}
|
||||
prov := &Provider{}
|
||||
got := prov.getHealthCheckPath(app)
|
||||
|
@ -1595,7 +1595,7 @@ func TestMarathonGetHealthCheckInterval(t *testing.T) {
|
|||
Labels: &map[string]string{},
|
||||
}
|
||||
if test.value != nil {
|
||||
app.AddLabel(labelBackendHealthCheckInterval, *test.value)
|
||||
app.AddLabel(types.LabelBackendHealthcheckInterval, *test.value)
|
||||
}
|
||||
prov := &Provider{}
|
||||
got := prov.getHealthCheckInterval(app)
|
||||
|
@ -1825,7 +1825,7 @@ func TestMarathonGetBasicAuth(t *testing.T) {
|
|||
desc: "basic auth label is set with user:password",
|
||||
application: marathon.Application{
|
||||
Labels: &map[string]string{
|
||||
"traefik.frontend.auth.basic": "user:password",
|
||||
types.LabelFrontendAuthBasic: "user:password",
|
||||
},
|
||||
},
|
||||
expected: []string{"user:password"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue