-
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.
* bug fix and tests * Update pkg/netpol/connlist/internal/ingressanalyzer/ingress_analyzer.go Co-authored-by: Adi Sosnovich <[email protected]> * typo fix * reverting some changes (1 &3 in PR desc.) * deleting un-necessary tests (results same as main) * comments --------- Co-authored-by: Adi Sosnovich <[email protected]>
- Loading branch information
1 parent
b539c01
commit eb62282
Showing
13 changed files
with
255 additions
and
46 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
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
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
3 changes: 3 additions & 0 deletions
3
test_outputs/connlist/netpol_named_port_test_2_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,3 @@ | ||
0.0.0.0-255.255.255.255 => helloworld/pod-a[Deployment] : All Connections | ||
helloworld/pod-a[Deployment] => 0.0.0.0-255.255.255.255 : All Connections | ||
helloworld/pod-a[Deployment] => helloworld/new-pod[Deployment] : SCTP 8956,9090 |
2 changes: 2 additions & 0 deletions
2
test_outputs/connlist/netpol_named_port_test_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,2 @@ | ||
0.0.0.0-255.255.255.255 => helloworld/new-pod[Deployment] : All Connections | ||
helloworld/new-pod[Deployment] => 0.0.0.0-255.255.255.255 : All Connections |
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,18 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: enable-ingress-from-named-port | ||
namespace: helloworld | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: app-a | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- from: | ||
- namespaceSelector: {} | ||
ports: | ||
- port: newport # this port with its protocol has no match in the pod configuration | ||
protocol: UDP |
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,59 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: helloworld | ||
spec: {} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pod-a | ||
namespace: helloworld | ||
labels: | ||
app: app-a | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: app-a | ||
template: | ||
metadata: | ||
labels: | ||
app: app-a | ||
spec: | ||
containers: | ||
- name: helloworld | ||
image: quay.io/shfa/app-a:latest | ||
ports: | ||
- name: newport | ||
containerPort: 8956 | ||
protocol: SCTP | ||
- name: udps | ||
containerport: 3535 | ||
protocol: UDP | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: new-pod | ||
namespace: helloworld | ||
labels: | ||
app: app-b | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: app-b | ||
template: | ||
metadata: | ||
labels: | ||
app: app-b | ||
spec: | ||
containers: | ||
- name: helloworld | ||
image: quay.io/shfa/ingress-world:latest | ||
ports: | ||
- containerPort: 8956 # containerport1 | ||
protocol: SCTP | ||
- containerPort: 8050 # containerport2 | ||
- containerPort: 8090 # containerport3 | ||
--- |
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: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: enable-ingress-from-named-port | ||
namespace: helloworld | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: app-b | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- from: | ||
- namespaceSelector: {} | ||
ports: | ||
- port: newport # this port with its protocol has no match in the pod configuration | ||
protocol: UDP | ||
- port: sctp-port # its matching port number in the pod configuration is 8956 | ||
protocol: SCTP | ||
- port: newport # its matching port number in the pod configuration is 9090 | ||
protocol: SCTP | ||
- port: not-found # this port with its protocol has no match in the pod configuration | ||
protocol: SCTP |
Oops, something went wrong.