-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for access-control using policies in vs and vsr (#1101)
* update policy tests with scenarios for routes and sub-routes for vs and vsr respectively
- Loading branch information
Showing
20 changed files
with
711 additions
and
28 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
tests/data/access-control/route-subroute/virtual-server-allow-route.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server | ||
spec: | ||
host: virtual-server.example.com | ||
upstreams: | ||
- name: backend2 | ||
service: backend2-svc | ||
port: 80 | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
routes: | ||
- path: "/backend1" | ||
policies: | ||
- name: allow-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backend2" | ||
action: | ||
pass: backend2 |
22 changes: 22 additions & 0 deletions
22
tests/data/access-control/route-subroute/virtual-server-deny-route.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server | ||
spec: | ||
host: virtual-server.example.com | ||
upstreams: | ||
- name: backend2 | ||
service: backend2-svc | ||
port: 80 | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
routes: | ||
- path: "/backend1" | ||
policies: | ||
- name: deny-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backend2" | ||
action: | ||
pass: backend2 |
22 changes: 22 additions & 0 deletions
22
tests/data/access-control/route-subroute/virtual-server-invalid-route.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server | ||
spec: | ||
host: virtual-server.example.com | ||
upstreams: | ||
- name: backend2 | ||
service: backend2-svc | ||
port: 80 | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
routes: | ||
- path: "/backend1" | ||
policies: | ||
- name: invalid-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backend2" | ||
action: | ||
pass: backend2 |
23 changes: 23 additions & 0 deletions
23
tests/data/access-control/route-subroute/virtual-server-override-route.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server | ||
spec: | ||
host: virtual-server.example.com | ||
upstreams: | ||
- name: backend2 | ||
service: backend2-svc | ||
port: 80 | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
routes: | ||
- path: "/backend1" | ||
policies: | ||
- name: allow-policy | ||
- name: deny-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backend2" | ||
action: | ||
pass: backend2 |
24 changes: 24 additions & 0 deletions
24
tests/data/access-control/route-subroute/virtual-server-override-spec-route.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server | ||
spec: | ||
host: virtual-server.example.com | ||
policies: | ||
- name: deny-policy | ||
upstreams: | ||
- name: backend2 | ||
service: backend2-svc | ||
port: 80 | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
routes: | ||
- path: "/backend1" | ||
policies: | ||
- name: allow-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backend2" | ||
action: | ||
pass: backend2 |
22 changes: 22 additions & 0 deletions
22
tests/data/access-control/route-subroute/virtual-server-route-allow-subroute.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServerRoute | ||
metadata: | ||
name: backends | ||
spec: | ||
host: virtual-server-route.example.com | ||
upstreams: | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
- name: backend3 | ||
service: backend3-svc | ||
port: 80 | ||
subroutes: | ||
- path: "/backends/backend1" | ||
policies: | ||
- name: allow-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backends/backend3" | ||
action: | ||
pass: backend3 |
22 changes: 22 additions & 0 deletions
22
tests/data/access-control/route-subroute/virtual-server-route-deny-subroute.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServerRoute | ||
metadata: | ||
name: backends | ||
spec: | ||
host: virtual-server-route.example.com | ||
upstreams: | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
- name: backend3 | ||
service: backend3-svc | ||
port: 80 | ||
subroutes: | ||
- path: "/backends/backend1" | ||
policies: | ||
- name: deny-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backends/backend3" | ||
action: | ||
pass: backend3 |
22 changes: 22 additions & 0 deletions
22
tests/data/access-control/route-subroute/virtual-server-route-invalid-subroute.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServerRoute | ||
metadata: | ||
name: backends | ||
spec: | ||
host: virtual-server-route.example.com | ||
upstreams: | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
- name: backend3 | ||
service: backend3-svc | ||
port: 80 | ||
subroutes: | ||
- path: "/backends/backend1" | ||
policies: | ||
- name: invalid-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backends/backend3" | ||
action: | ||
pass: backend3 |
23 changes: 23 additions & 0 deletions
23
tests/data/access-control/route-subroute/virtual-server-route-override-subroute.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServerRoute | ||
metadata: | ||
name: backends | ||
spec: | ||
host: virtual-server-route.example.com | ||
upstreams: | ||
- name: backend1 | ||
service: backend1-svc | ||
port: 80 | ||
- name: backend3 | ||
service: backend3-svc | ||
port: 80 | ||
subroutes: | ||
- path: "/backends/backend1" | ||
policies: | ||
- name: deny-policy | ||
- name: allow-policy | ||
action: | ||
pass: backend1 | ||
- path: "/backends/backend3" | ||
action: | ||
pass: backend3 |
13 changes: 13 additions & 0 deletions
13
tests/data/access-control/route-subroute/virtual-server-vsr-route-override.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server-route | ||
spec: | ||
host: virtual-server-route.example.com | ||
routes: | ||
- path: "/backends" | ||
policies: | ||
- name: deny-policy | ||
route: backends | ||
- path: "/backend2" | ||
route: backend2-namespace/backend2 |
13 changes: 13 additions & 0 deletions
13
tests/data/access-control/route-subroute/virtual-server-vsr-spec-override.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: k8s.nginx.org/v1 | ||
kind: VirtualServer | ||
metadata: | ||
name: virtual-server-route | ||
spec: | ||
host: virtual-server-route.example.com | ||
policies: | ||
- name: deny-policy | ||
routes: | ||
- path: "/backends" | ||
route: backends | ||
- path: "/backend2" | ||
route: backend2-namespace/backend2 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.