Server weight zero
This commit is contained in:
parent
edbcd01fbc
commit
8168d2fdc1
84 changed files with 378 additions and 273 deletions
|
@ -39,8 +39,8 @@ func (p *Provider) buildConfigurationV2(tasks []state.Task) *types.Configuration
|
|||
"getFrontEndName": getFrontendName,
|
||||
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
|
||||
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
|
||||
"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),
|
||||
"getFrontendRule": p.getFrontendRule,
|
||||
"getRedirect": label.GetRedirect,
|
||||
|
@ -184,7 +184,7 @@ func (p *Provider) getServers(tasks []taskData) map[string]types.Server {
|
|||
serverName := "server-" + getID(task)
|
||||
servers[serverName] = types.Server{
|
||||
URL: fmt.Sprintf("%s://%s:%s", protocol, host, port),
|
||||
Weight: getIntValue(task.TraefikLabels, label.TraefikWeight, label.DefaultWeightInt, math.MaxInt32),
|
||||
Weight: getIntValue(task.TraefikLabels, label.TraefikWeight, label.DefaultWeight, math.MaxInt32),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,11 +90,11 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-ID1": {
|
||||
URL: "http://10.10.10.10:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-ID2": {
|
||||
URL: "http://10.10.10.11:81",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -102,11 +102,11 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-ID3": {
|
||||
URL: "http://20.10.10.10:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-ID4": {
|
||||
URL: "http://20.10.10.11:81",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -617,7 +617,7 @@ func TestGetServers(t *testing.T) {
|
|||
expected: map[string]types.Server{
|
||||
"server-ID1": {
|
||||
URL: "http://10.10.10.10:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-ID2": {
|
||||
URL: "http://10.10.10.11:81",
|
||||
|
|
|
@ -24,7 +24,7 @@ func (p *Provider) buildConfigurationV1(tasks []state.Task) *types.Configuration
|
|||
"getBackendName": getBackendNameV1,
|
||||
"getHost": p.getHostV1,
|
||||
"getProtocol": getFuncApplicationStringValueV1(label.TraefikProtocol, label.DefaultProtocol),
|
||||
"getWeight": getFuncApplicationIntValueV1(label.TraefikWeight, label.DefaultWeightInt),
|
||||
"getWeight": getFuncApplicationIntValueV1(label.TraefikWeight, label.DefaultWeight),
|
||||
"getBackend": getBackendV1,
|
||||
"getPort": p.getPort,
|
||||
|
||||
|
@ -33,8 +33,8 @@ func (p *Provider) buildConfigurationV1(tasks []state.Task) *types.Configuration
|
|||
"getFrontEndName": getFrontendNameV1,
|
||||
"getEntryPoints": getFuncSliceStringValueV1(label.TraefikFrontendEntryPoints),
|
||||
"getBasicAuth": getFuncSliceStringValueV1(label.TraefikFrontendAuthBasic),
|
||||
"getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
|
||||
"getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
|
||||
"getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getFrontendRule": p.getFrontendRuleV1,
|
||||
}
|
||||
|
||||
|
|
|
@ -86,11 +86,11 @@ func TestBuildConfigurationV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-ID1": {
|
||||
URL: "http://10.10.10.10:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-ID2": {
|
||||
URL: "http://10.10.10.11:81",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -98,11 +98,11 @@ func TestBuildConfigurationV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-ID3": {
|
||||
URL: "http://20.10.10.10:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-ID4": {
|
||||
URL: "http://20.10.10.11:81",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue