Server weight zero
This commit is contained in:
parent
edbcd01fbc
commit
8168d2fdc1
84 changed files with 378 additions and 273 deletions
|
@ -29,8 +29,8 @@ func (p *Provider) buildConfigurationV2(services []rancherData) *types.Configura
|
|||
// Frontend functions
|
||||
"getBackendName": getBackendName,
|
||||
"getFrontendRule": p.getFrontendRule,
|
||||
"getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
|
||||
"getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
|
||||
"getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
|
||||
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
|
||||
|
@ -170,7 +170,7 @@ func getServers(service rancherData) map[string]types.Server {
|
|||
|
||||
protocol := label.GetStringValue(service.SegmentLabels, label.TraefikProtocol, label.DefaultProtocol)
|
||||
port := label.GetStringValue(service.SegmentLabels, label.TraefikPort, "")
|
||||
weight := label.GetIntValue(service.SegmentLabels, label.TraefikWeight, label.DefaultWeightInt)
|
||||
weight := label.GetIntValue(service.SegmentLabels, label.TraefikWeight, label.DefaultWeight)
|
||||
|
||||
serverName := "server-" + strconv.Itoa(index)
|
||||
servers[serverName] = types.Server{
|
||||
|
|
|
@ -454,7 +454,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-0": {
|
||||
URL: "http://127.0.0.1:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
CircuitBreaker: nil,
|
||||
|
@ -855,7 +855,7 @@ func TestGetServers(t *testing.T) {
|
|||
expected: map[string]types.Server{
|
||||
"server-0": {
|
||||
URL: "http://10.10.10.0:",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -18,7 +18,7 @@ func (p *Provider) buildConfigurationV1(services []rancherData) *types.Configura
|
|||
// Backend functions
|
||||
"getPort": getFuncStringV1(label.TraefikPort, ""),
|
||||
"getProtocol": getFuncStringV1(label.TraefikProtocol, label.DefaultProtocol),
|
||||
"getWeight": getFuncIntV1(label.TraefikWeight, label.DefaultWeightInt),
|
||||
"getWeight": getFuncIntV1(label.TraefikWeight, label.DefaultWeight),
|
||||
"hasCircuitBreakerLabel": hasFuncV1(label.TraefikBackendCircuitBreakerExpression),
|
||||
"getCircuitBreakerExpression": getFuncStringV1(label.TraefikBackendCircuitBreakerExpression, label.DefaultCircuitBreakerExpression),
|
||||
"hasLoadBalancerLabel": hasLoadBalancerLabel,
|
||||
|
@ -33,8 +33,8 @@ func (p *Provider) buildConfigurationV1(services []rancherData) *types.Configura
|
|||
// Frontend functions
|
||||
"getBackend": getBackendNameV1,
|
||||
"getFrontendRule": p.getFrontendRuleV1,
|
||||
"getPriority": getFuncIntV1(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
|
||||
"getPassHostHeader": getFuncBoolV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
|
||||
"getPriority": getFuncIntV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getPassHostHeader": getFuncBoolV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getEntryPoints": getFuncSliceStringV1(label.TraefikFrontendEntryPoints),
|
||||
"getBasicAuth": getFuncSliceStringV1(label.TraefikFrontendAuthBasic),
|
||||
"hasRedirect": hasRedirect,
|
||||
|
|
|
@ -149,7 +149,7 @@ func TestProviderBuildConfigurationV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-0": {
|
||||
URL: "http://127.0.0.1:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
CircuitBreaker: nil,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue