diff --git a/dataclients/kubernetes/definitions/routegroups.go b/dataclients/kubernetes/definitions/routegroups.go index f39f9fdc04..874c0593a0 100644 --- a/dataclients/kubernetes/definitions/routegroups.go +++ b/dataclients/kubernetes/definitions/routegroups.go @@ -231,10 +231,6 @@ func (sb *SkipperBackend) UnmarshalJSON(value []byte) error { perr = err } - if a == loadbalancer.None { - a = loadbalancer.RoundRobin - } - var b SkipperBackend b.Name = p.Name b.Type = bt diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.eskip b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.eskip new file mode 100644 index 0000000000..f6b1ffb535 --- /dev/null +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.eskip @@ -0,0 +1,6 @@ +kube_rg__default__myapp__all__0_0: + Host("^(example[.]org[.]?(:[0-9]+)?)$") + && PathSubtree("/") + -> ; + +kube_rg____example_org__catchall__0_0: Host("^(example[.]org[.]?(:[0-9]+)?)$") -> ; diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.kube b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.kube new file mode 100644 index 0000000000..390d0c8a2d --- /dev/null +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.kube @@ -0,0 +1 @@ +default-lb-algorithm: consistentHash diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.yaml b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.yaml new file mode 100644 index 0000000000..5e266a14e4 --- /dev/null +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-override.yaml @@ -0,0 +1,50 @@ +apiVersion: zalando.org/v1 +kind: RouteGroup +metadata: + name: myapp +spec: + hosts: + - example.org + backends: + - name: myapp + type: service + serviceName: myapp + servicePort: 80 + algorithm: powerOfRandomNChoices + routes: + - pathSubtree: / + backends: + - backendName: myapp +--- +apiVersion: v1 +kind: Service +metadata: + labels: + application: myapp + name: myapp +spec: + clusterIP: 10.3.190.97 + ports: + - name: main + port: 80 + protocol: TCP + targetPort: 7272 + selector: + application: myapp + type: ClusterIP +--- +apiVersion: v1 +kind: Endpoints +metadata: + labels: + application: myapp + name: myapp + namespace: default +subsets: +- addresses: + - ip: 10.2.9.103 + - ip: 10.2.9.104 + ports: + - name: main + port: 7272 + protocol: TCP diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.eskip b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.eskip new file mode 100644 index 0000000000..e6c45fb138 --- /dev/null +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.eskip @@ -0,0 +1,6 @@ +kube_rg__default__myapp__all__0_0: + Host("^(example[.]org[.]?(:[0-9]+)?)$") + && PathSubtree("/") + -> ; + +kube_rg____example_org__catchall__0_0: Host("^(example[.]org[.]?(:[0-9]+)?)$") -> ; diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.kube b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.kube new file mode 100644 index 0000000000..1d160f86f7 --- /dev/null +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.kube @@ -0,0 +1 @@ +default-lb-algorithm: does-not-exist diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.yaml b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.yaml new file mode 100644 index 0000000000..47d1f40774 --- /dev/null +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm-with-wrong-spelling.yaml @@ -0,0 +1,49 @@ +apiVersion: zalando.org/v1 +kind: RouteGroup +metadata: + name: myapp +spec: + hosts: + - example.org + backends: + - name: myapp + type: service + serviceName: myapp + servicePort: 80 + routes: + - pathSubtree: / + backends: + - backendName: myapp +--- +apiVersion: v1 +kind: Service +metadata: + labels: + application: myapp + name: myapp +spec: + clusterIP: 10.3.190.97 + ports: + - name: main + port: 80 + protocol: TCP + targetPort: 7272 + selector: + application: myapp + type: ClusterIP +--- +apiVersion: v1 +kind: Endpoints +metadata: + labels: + application: myapp + name: myapp + namespace: default +subsets: +- addresses: + - ip: 10.2.9.103 + - ip: 10.2.9.104 + ports: + - name: main + port: 7272 + protocol: TCP diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.eskip b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.eskip index e6c45fb138..2c64f59b37 100644 --- a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.eskip +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.eskip @@ -1,6 +1,6 @@ kube_rg__default__myapp__all__0_0: Host("^(example[.]org[.]?(:[0-9]+)?)$") && PathSubtree("/") - -> ; + -> ; kube_rg____example_org__catchall__0_0: Host("^(example[.]org[.]?(:[0-9]+)?)$") -> ; diff --git a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.kube b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.kube index ee049249d9..390d0c8a2d 100644 --- a/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.kube +++ b/dataclients/kubernetes/testdata/routegroups/loadbalancer-algorithm/default-ch-algorithm.kube @@ -1 +1 @@ -default-lb-algorithm: consistantHash +default-lb-algorithm: consistentHash