Skip to content

Commit

Permalink
Update tests according to the improved routing rules.
Browse files Browse the repository at this point in the history
Add tests for VSR split traffic and advanced routing.
Add tests for focused canary deployment.
  • Loading branch information
tellet authored and pleshakov committed Oct 31, 2019
1 parent 67c2c5e commit d0a285c
Show file tree
Hide file tree
Showing 58 changed files with 995 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ spec:
port: 80
routes:
- path: "/backends"
rules:
conditions:
matches:
- conditions:
- header: x-version
matches:
- values:
- future
upstream: backend1-future
- values:
- deprecated
upstream: backend3-deprecated
defaultUpstream: backend4-stable
value: future
action:
pass: backend1-future
- conditions:
- header: x-version
value: deprecated
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ spec:
port: 80
routes:
- path: "/backends"
rules:
conditions:
matches:
- conditions:
- argument: arg1
matches:
- values:
- v1
upstream: backend1-future
- values:
- v2
upstream: backend3-deprecated
defaultUpstream: backend4-stable
value: v1
action:
pass: backend1-future
- conditions:
- argument: arg1
value: v2
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,31 @@ spec:
port: 80
routes:
- path: "/backends"
rules:
conditions:
matches:
- conditions:
- header: x-version
value: future
- cookie: user
value: some
- argument: arg1
value: v1
- variable: $request_method
matches:
- values:
- future
- some
- v1
- get
upstream: backend1-future
- values:
- deprecated
- bad
- v2
- post
upstream: backend3-deprecated
defaultUpstream: backend4-stable
value: get
action:
pass: backend1-future
- conditions:
- header: x-version
value: deprecated
- cookie: user
value: bad
- argument: arg1
value: v2
- variable: $request_method
value: post
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ spec:
port: 80
routes:
- path: "/backends"
rules:
conditions:
matches:
- conditions:
- cookie: user
matches:
- values:
- some
upstream: backend1-future
- values:
- bad
upstream: backend3-deprecated
defaultUpstream: backend4-stable
value: some
action:
pass: backend1-future
- conditions:
- cookie: user
value: bad
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ spec:
port: 80
routes:
- path: "/backends"
rules:
conditions:
matches:
- conditions:
- variable: $request_method
matches:
- values:
- get
upstream: backend1-future
- values:
- post
upstream: backend3-deprecated
defaultUpstream: backend4-stable
value: get
action:
pass: backend1-future
- conditions:
- variable: $request_method
value: post
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ spec:
port: 80
routes:
- path: "/backend1"
upstream: backend1
action:
pass: backend1
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ spec:
port: 80
routes:
- path: "/backend1"
upstream: backend1
action:
pass: backend1
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ spec:
port: 80
routes:
- path: "/backend1"
upstream: backend1
action:
pass: backend1
- path: "/backend2"
upstream: backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: k8s.nginx.org/v1alpha1
kind: VirtualServer
metadata:
name: virtual-server-canary
spec:
host: virtual-server-canary.example.com
upstreams:
- name: backend1
service: backend1-svc
port: 80
- name: backend2
service: backend2-svc
port: 80
routes:
- path: "/backends/focused-canary"
matches:
- conditions:
- header: x-version
value: canary
splits:
- weight: 90
action:
pass: backend1
- weight: 10
action:
pass: backend2
action:
pass: backend1
- path: "/backend2"
action:
pass: backend2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: k8s.nginx.org/v1alpha1
kind: VirtualServer
metadata:
name: virtual-server-route
spec:
host: virtual-server-route.example.com
routes:
- path: "/backends"
route: backends-namespace/backends
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: k8s.nginx.org/v1alpha1
kind: VirtualServerRoute
metadata:
name: backends
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
- name: backend4-stable
service: backend4-stable-svc
port: 80
- name: backend1-future
service: backend1-future-svc
port: 80
- name: backend3-deprecated
service: backend3-deprecated-svc
port: 80
subroutes:
- path: "/backends/backend1"
matches:
- conditions:
- argument: arg1
value: v1
action:
pass: backend1-future
- conditions:
- argument: arg1
value: v2
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backends/backend2"
action:
pass: backend2
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: k8s.nginx.org/v1alpha1
kind: VirtualServerRoute
metadata:
name: backends
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
- name: backend4-stable
service: backend4-stable-svc
port: 80
- name: backend1-future
service: backend1-future-svc
port: 80
- name: backend3-deprecated
service: backend3-deprecated-svc
port: 80
subroutes:
- path: "/backends/backend1"
matches:
- conditions:
- header: x-version
value: future
- cookie: user
value: some
- argument: arg1
value: v1
- variable: $request_method
value: get
action:
pass: backend1-future
- conditions:
- header: x-version
value: deprecated
- cookie: user
value: bad
- argument: arg1
value: v2
- variable: $request_method
value: post
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backends/backend2"
action:
pass: backend2
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: k8s.nginx.org/v1alpha1
kind: VirtualServerRoute
metadata:
name: backends
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
- name: backend4-stable
service: backend4-stable-svc
port: 80
- name: backend1-future
service: backend1-future-svc
port: 80
- name: backend3-deprecated
service: backend3-deprecated-svc
port: 80
subroutes:
- path: "/backends/backend1"
matches:
- conditions:
- cookie: user
value: some
action:
pass: backend1-future
- conditions:
- cookie: user
value: bad
action:
pass: backend3-deprecated
action:
pass: backend4-stable
- path: "/backends/backend2"
action:
pass: backend2
Loading

0 comments on commit d0a285c

Please sign in to comment.