-
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.
fixing single anp conns compute when ingress and egress are intersect…
…ed (not fully matched)
- Loading branch information
1 parent
e168f41
commit 813bf1b
Showing
6 changed files
with
251 additions
and
4 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
30 changes: 30 additions & 0 deletions
30
test_outputs/connlist/anp_test_ingress_egress_intersection_connlist_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,30 @@ | ||
0.0.0.0-255.255.255.255 => bar-ns/bar[Deployment] : All Connections | ||
0.0.0.0-255.255.255.255 => foo-ns-1/foo[Deployment] : All Connections | ||
0.0.0.0-255.255.255.255 => foo-ns-2/foo[Deployment] : All Connections | ||
0.0.0.0-255.255.255.255 => kube-system/kube-dns[Deployment] : All Connections | ||
0.0.0.0-255.255.255.255 => monitoring-ns/monitoring[Deployment] : All Connections | ||
bar-ns/bar[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
bar-ns/bar[Deployment] => foo-ns-1/foo[Deployment] : UDP 5353 | ||
bar-ns/bar[Deployment] => foo-ns-2/foo[Deployment] : UDP 5353 | ||
bar-ns/bar[Deployment] => kube-system/kube-dns[Deployment] : UDP 5353 | ||
bar-ns/bar[Deployment] => monitoring-ns/monitoring[Deployment] : UDP 5353 | ||
foo-ns-1/foo[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
foo-ns-1/foo[Deployment] => bar-ns/bar[Deployment] : UDP 5353 | ||
foo-ns-1/foo[Deployment] => foo-ns-2/foo[Deployment] : UDP 5353 | ||
foo-ns-1/foo[Deployment] => kube-system/kube-dns[Deployment] : UDP 5353 | ||
foo-ns-1/foo[Deployment] => monitoring-ns/monitoring[Deployment] : UDP 5353 | ||
foo-ns-2/foo[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
foo-ns-2/foo[Deployment] => bar-ns/bar[Deployment] : UDP 5353 | ||
foo-ns-2/foo[Deployment] => foo-ns-1/foo[Deployment] : UDP 5353 | ||
foo-ns-2/foo[Deployment] => kube-system/kube-dns[Deployment] : UDP 5353 | ||
foo-ns-2/foo[Deployment] => monitoring-ns/monitoring[Deployment] : UDP 5353 | ||
kube-system/kube-dns[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
kube-system/kube-dns[Deployment] => bar-ns/bar[Deployment] : UDP 5353 | ||
kube-system/kube-dns[Deployment] => foo-ns-1/foo[Deployment] : UDP 5353 | ||
kube-system/kube-dns[Deployment] => foo-ns-2/foo[Deployment] : UDP 5353 | ||
kube-system/kube-dns[Deployment] => monitoring-ns/monitoring[Deployment] : UDP 5353 | ||
monitoring-ns/monitoring[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
monitoring-ns/monitoring[Deployment] => bar-ns/bar[Deployment] : UDP 5353 | ||
monitoring-ns/monitoring[Deployment] => foo-ns-1/foo[Deployment] : UDP 5353 | ||
monitoring-ns/monitoring[Deployment] => foo-ns-2/foo[Deployment] : UDP 5353 | ||
monitoring-ns/monitoring[Deployment] => kube-system/kube-dns[Deployment] : UDP 5353 |
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,26 @@ | ||
apiVersion: policy.networking.k8s.io/v1alpha1 | ||
kind: AdminNetworkPolicy | ||
metadata: | ||
name: cluster-allow-example | ||
spec: | ||
priority: 30 | ||
subject: | ||
namespaces: {} | ||
ingress: | ||
- action: Allow | ||
from: | ||
- namespaces: {} | ||
ports: | ||
- portNumber: | ||
protocol: UDP | ||
port: 5353 | ||
- action: Deny # deny others | ||
from: | ||
- namespaces: {} | ||
egress: | ||
- action: Allow | ||
to: | ||
- namespaces: | ||
namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: foo-ns-2 |
143 changes: 143 additions & 0 deletions
143
tests/anp_test_ingress_egress_intersection/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,143 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: foo-ns-1 | ||
spec: {} | ||
--- | ||
|
||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: foo-ns-2 | ||
spec: {} | ||
--- | ||
|
||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: bar-ns | ||
spec: {} | ||
--- | ||
|
||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: monitoring-ns | ||
spec: {} | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: foo | ||
namespace: foo-ns-1 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: foo | ||
template: | ||
metadata: | ||
labels: | ||
app: foo | ||
spec: | ||
containers: | ||
- name: foo | ||
image: netpol/example1 | ||
args: | ||
- -name | ||
- foo | ||
- -port | ||
- "5698" | ||
ports: | ||
- name: http | ||
containerPort: 5698 | ||
protocol: TCP | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: foo | ||
namespace: foo-ns-2 | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: foo | ||
template: | ||
metadata: | ||
labels: | ||
app: foo | ||
spec: | ||
containers: | ||
- name: foo | ||
image: netpol/example1 | ||
args: | ||
- -name | ||
- foo | ||
- -port | ||
- "5698" | ||
ports: | ||
- name: http | ||
containerPort: 5698 | ||
protocol: TCP | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: bar | ||
namespace: bar-ns | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: bar | ||
template: | ||
metadata: | ||
labels: | ||
app: bar | ||
spec: | ||
containers: | ||
- name: bar | ||
image: netpol/example1 | ||
args: | ||
- -name | ||
- bar | ||
- -port | ||
- "8956" | ||
ports: | ||
- name: http | ||
containerPort: 8956 | ||
protocol: TCP | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: monitoring | ||
namespace: monitoring-ns | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: monitoring | ||
template: | ||
metadata: | ||
labels: | ||
app: bar | ||
spec: | ||
containers: | ||
- name: monitoring | ||
image: netpol/example1 | ||
args: | ||
- -name | ||
- monitoring | ||
- -port | ||
- "8956" | ||
ports: | ||
- name: http | ||
containerPort: 8956 | ||
protocol: TCP | ||
--- |
34 changes: 34 additions & 0 deletions
34
tests/anp_test_ingress_egress_intersection/kube_system_pod.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,34 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: kube-system | ||
spec: {} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: kube-dns | ||
namespace: kube-system | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: kube-dns | ||
template: | ||
metadata: | ||
labels: | ||
app: kube-dns | ||
spec: | ||
containers: | ||
- name: kube-dns | ||
image: netpol/example2 | ||
args: | ||
- -name | ||
- kube-dns | ||
- -port | ||
- "5698" | ||
ports: | ||
- name: http | ||
containerPort: 5698 | ||
protocol: TCP | ||
--- |