Server weight zero
This commit is contained in:
parent
edbcd01fbc
commit
8168d2fdc1
84 changed files with 378 additions and 273 deletions
|
@ -43,9 +43,9 @@ func (p *Provider) buildConfigurationV2(applications *marathon.Applications) *ty
|
|||
"getSegmentNameSuffix": getSegmentNameSuffix,
|
||||
"getFrontendRule": p.getFrontendRule,
|
||||
"getFrontendName": p.getFrontendName,
|
||||
"getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
|
||||
"getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||
"getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
|
||||
"getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
|
||||
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
|
||||
"getRedirect": label.GetRedirect,
|
||||
|
@ -339,7 +339,7 @@ func (p *Provider) getServer(app appData, task marathon.Task) (string, *types.Se
|
|||
|
||||
return serverName, &types.Server{
|
||||
URL: fmt.Sprintf("%s://%s:%v", protocol, host, port),
|
||||
Weight: label.GetIntValue(app.SegmentLabels, label.TraefikWeight, label.DefaultWeightInt),
|
||||
Weight: label.GetIntValue(app.SegmentLabels, label.TraefikWeight, label.DefaultWeight),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-app-taskID": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
CircuitBreaker: nil,
|
||||
|
@ -119,7 +119,7 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-app-taskID": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
MaxConn: nil,
|
||||
|
@ -152,7 +152,7 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-app-taskID": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -420,11 +420,11 @@ func TestBuildConfiguration(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-foo-v000-taskID-service-main": {
|
||||
URL: "http://localhost:8080",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-foo-v001-taskID-service-main": {
|
||||
URL: "http://localhost:8081",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -503,7 +503,7 @@ func TestBuildConfigurationSegments(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-app-taskID-service-web": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
MaxConn: &types.MaxConn{
|
||||
|
@ -515,7 +515,7 @@ func TestBuildConfigurationSegments(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-app-taskID-service-admin": {
|
||||
URL: "http://localhost:81",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
MaxConn: &types.MaxConn{
|
||||
|
@ -1278,15 +1278,15 @@ func TestGetServers(t *testing.T) {
|
|||
expected: map[string]types.Server{
|
||||
"server-A": {
|
||||
URL: "http://1.1.1.1:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-B": {
|
||||
URL: "http://1.1.1.2:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
"server-C": {
|
||||
URL: "http://1.1.1.3:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ func (p *Provider) buildConfigurationV1(applications *marathon.Applications) *ty
|
|||
"getPort": getPortV1,
|
||||
"getServers": p.getServersV1,
|
||||
|
||||
"getWeight": getFuncIntServiceV1(label.SuffixWeight, label.DefaultWeightInt),
|
||||
"getWeight": getFuncIntServiceV1(label.SuffixWeight, label.DefaultWeight),
|
||||
"getProtocol": getFuncStringServiceV1(label.SuffixProtocol, label.DefaultProtocol),
|
||||
"hasCircuitBreakerLabels": hasFuncV1(label.TraefikBackendCircuitBreakerExpression),
|
||||
"getCircuitBreakerExpression": getFuncStringV1(label.TraefikBackendCircuitBreakerExpression, label.DefaultCircuitBreakerExpression),
|
||||
|
@ -46,9 +46,9 @@ func (p *Provider) buildConfigurationV1(applications *marathon.Applications) *ty
|
|||
// Frontend functions
|
||||
"getServiceNames": getServiceNamesV1,
|
||||
"getServiceNameSuffix": getSegmentNameSuffix,
|
||||
"getPassHostHeader": getFuncBoolServiceV1(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
|
||||
"getPassHostHeader": getFuncBoolServiceV1(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getPassTLSCert": getFuncBoolServiceV1(label.SuffixFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||
"getPriority": getFuncIntServiceV1(label.SuffixFrontendPriority, label.DefaultFrontendPriorityInt),
|
||||
"getPriority": getFuncIntServiceV1(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getEntryPoints": getFuncSliceStringServiceV1(label.SuffixFrontendEntryPoints),
|
||||
"getFrontendRule": p.getFrontendRuleV1,
|
||||
"getFrontendName": p.getFrontendNameV1,
|
||||
|
@ -323,7 +323,7 @@ func (p *Provider) getServersV1(application marathon.Application, serviceName st
|
|||
serverName := provider.Normalize("server-" + task.ID + getSegmentNameSuffix(serviceName))
|
||||
servers[serverName] = types.Server{
|
||||
URL: fmt.Sprintf("%s://%s:%v", protocol, host, port),
|
||||
Weight: label.GetIntValue(labels, getLabelNameV1(serviceName, label.SuffixWeight), label.DefaultWeightInt),
|
||||
Weight: label.GetIntValue(labels, getLabelNameV1(serviceName, label.SuffixWeight), label.DefaultWeight),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ func TestBuildConfigurationV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-task": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
CircuitBreaker: nil,
|
||||
|
@ -112,7 +112,7 @@ func TestBuildConfigurationV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-task": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
MaxConn: nil,
|
||||
|
@ -143,7 +143,7 @@ func TestBuildConfigurationV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-task": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -306,7 +306,7 @@ func TestBuildConfigurationServicesV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-task-service-web": {
|
||||
URL: "http://localhost:80",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
MaxConn: &types.MaxConn{
|
||||
|
@ -318,7 +318,7 @@ func TestBuildConfigurationServicesV1(t *testing.T) {
|
|||
Servers: map[string]types.Server{
|
||||
"server-task-service-admin": {
|
||||
URL: "http://localhost:81",
|
||||
Weight: 0,
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
MaxConn: &types.MaxConn{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue