1
0
Fork 0

Support canary weight for external name service

This commit is contained in:
Kim Min 2018-11-06 14:48:03 +08:00 committed by Traefiker Bot
parent fa562dc916
commit 057498ed01
4 changed files with 61 additions and 7 deletions

View file

@ -3232,6 +3232,7 @@ func TestPercentageWeightServiceAnnotation(t *testing.T) {
buildIngress(
iAnnotation(annotationKubernetesServiceWeights, `
service1: 10%
service3: 20%
`),
iNamespace("testing"),
iRules(
@ -3240,6 +3241,7 @@ service1: 10%
iPaths(
onePath(iPath("/foo"), iBackend("service1", intstr.FromString("8080"))),
onePath(iPath("/foo"), iBackend("service2", intstr.FromString("7070"))),
onePath(iPath("/foo"), iBackend("service3", intstr.FromString("9090"))),
onePath(iPath("/bar"), iBackend("service2", intstr.FromString("7070"))),
)),
),
@ -3264,6 +3266,16 @@ service1: 10%
sPorts(sPort(7070, "")),
),
),
buildService(
sName("service3"),
sNamespace("testing"),
sUID("1"),
sSpec(
sType(corev1.ServiceTypeExternalName),
sExternalName("example.com"),
sPorts(sPort(9090, "")),
),
),
}
endpoints := []*corev1.Endpoints{
@ -3311,8 +3323,9 @@ service1: 10%
servers(
server("http://10.10.0.1:8080", weight(int(newPercentageValueFromFloat64(0.05)))),
server("http://10.10.0.2:8080", weight(int(newPercentageValueFromFloat64(0.05)))),
server("http://10.10.0.3:7070", weight(int(newPercentageValueFromFloat64(0.45)))),
server("http://10.10.0.4:7070", weight(int(newPercentageValueFromFloat64(0.45)))),
server("http://10.10.0.3:7070", weight(int(newPercentageValueFromFloat64(0.35)))),
server("http://10.10.0.4:7070", weight(int(newPercentageValueFromFloat64(0.35)))),
server("http://example.com:9090", weight(int(newPercentageValueFromFloat64(0.2)))),
),
lbMethod("wrr"),
),