Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
e2e test for named ports
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil1602 committed Jan 27, 2021
1 parent 5462c0e commit 789b798
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
63 changes: 63 additions & 0 deletions e2e-manifests/15-allow-traffic-to-named-port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: myfancydeployment
role: api
name: my-deployment
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: myfancydeployment
role: api
template:
metadata:
labels:
app: myfancydeployment
role: api
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: apiserver
ports:
- containerPort: 80
name: mynamedport
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
labels:
app: bookstore
role: api
name: apiserver
spec:
ports:
- port: 80
protocol: TCP
targetPort: mynamedport
selector:
app: bookstore
role: api
type: ClusterIP
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: api-allow
spec:
podSelector:
matchLabels:
app: myfancydeployment
role: api
ingress:
- from:
- podSelector:
matchLabels:
role: frontend
ports:
- port: mynamedport
protocol: TCP
8 changes: 8 additions & 0 deletions e2e-manifests/expected/15-allow-traffic-to-named-port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
15-allow-traffic-to-named-port:app=bookstore,role=api:
15-allow-traffic-to-named-port:app=bookstore,role=api:
80:
success: true
illuminatio-inverted-15-allow-traffic-to-named-port:app=bookstore,role=api:
15-allow-traffic-to-named-port:app=bookstore,role=api:
-80:
success: true
1 change: 1 addition & 0 deletions tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def clean_cluster(core_v1):
"e2e_test_case",
[
"01-deny-all-traffic-to-an-application",
"15-allow-traffic-to-named-port",
"labels-with-all-legal-characters",
"max-length-labels",
],
Expand Down

0 comments on commit 789b798

Please sign in to comment.