-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d9bc9f
commit eb8eba2
Showing
6 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
19 changes: 19 additions & 0 deletions
19
test_outputs/connlist/exposure_test_with_anp_11_with_named_port_exposure_output.txt
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,19 @@ | ||
0.0.0.0-255.255.255.255 => hello-world/workload-b[Deployment] : All Connections | ||
hello-world/workload-a[Deployment] => hello-world/workload-b[Deployment] : TCP 8050 | ||
hello-world/workload-b[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
hello-world/workload-b[Deployment] => hello-world/workload-a[Deployment] : UDP 8050 | ||
|
||
Exposure Analysis Result: | ||
Egress Exposure: | ||
hello-world/workload-a[Deployment] => entire-cluster : local-port | ||
hello-world/workload-b[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
hello-world/workload-b[Deployment] => entire-cluster : All Connections | ||
|
||
Ingress Exposure: | ||
hello-world/workload-a[Deployment] <= entire-cluster : UDP 8050 | ||
hello-world/workload-b[Deployment] <= 0.0.0.0-255.255.255.255 : All Connections | ||
hello-world/workload-b[Deployment] <= entire-cluster : All Connections | ||
|
||
Workloads not protected by network policies: | ||
hello-world/workload-b[Deployment] is not protected on Egress | ||
hello-world/workload-b[Deployment] is not protected on Ingress |
55 changes: 55 additions & 0 deletions
55
tests/exposure_test_with_anp_11_with_named_port/deployments.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,55 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: hello-world | ||
spec: {} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: workload-a | ||
namespace: hello-world | ||
labels: | ||
app: a-app | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: a-app | ||
template: | ||
metadata: | ||
labels: | ||
app: a-app | ||
spec: | ||
containers: | ||
- name: hello-world | ||
image: quay.io/shfa/hello-world:latest | ||
ports: | ||
- containerPort: 8000 # containerport1 | ||
- name: local-port | ||
protocol: UDP | ||
containerPort: 8050 # containerport2 | ||
- containerPort: 8090 # containerport3 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: workload-b | ||
namespace: hello-world | ||
labels: | ||
app: b-app | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: b-app | ||
template: | ||
metadata: | ||
labels: | ||
app: b-app | ||
spec: | ||
containers: | ||
- name: hello-world | ||
image: quay.io/shfa/hello-world:latest | ||
ports: | ||
- name: local-port | ||
containerPort: 8050 |
41 changes: 41 additions & 0 deletions
41
tests/exposure_test_with_anp_11_with_named_port/policies.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,41 @@ | ||
apiVersion: policy.networking.k8s.io/v1alpha1 | ||
kind: AdminNetworkPolicy | ||
metadata: | ||
name: exposure-deny-peer-allow-entire-cluster-all-conns | ||
spec: | ||
priority: 10 | ||
subject: | ||
pods: | ||
namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: hello-world | ||
podSelector: | ||
matchLabels: | ||
app: a-app | ||
egress: | ||
- name: "allow-all-to-entire-cluster-on-local-port" | ||
action: "Allow" | ||
to: | ||
- namespaces: {} | ||
ports: | ||
- namedPort: local-port | ||
ingress: | ||
- name: "allow-all-from-entire-cluster-on-local-port" | ||
action: "Allow" | ||
from: | ||
- namespaces: {} | ||
ports: | ||
- namedPort: local-port | ||
--- | ||
kind: NetworkPolicy | ||
apiVersion: networking.k8s.io/v1 | ||
metadata: | ||
name: deny-all-app-a | ||
namespace: hello-world | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: a-app | ||
policyTypes: | ||
- Ingress | ||
- Egress |