-
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.
adding minimal example for connectivity analysis and diff (#208)
- Loading branch information
1 parent
75f57a8
commit 448241d
Showing
12 changed files
with
394 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: backend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: backendservice | ||
template: | ||
metadata: | ||
labels: | ||
app: backendservice | ||
spec: | ||
containers: | ||
- name: server | ||
image: backendservice | ||
ports: | ||
- containerPort: 9090 | ||
readinessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 9090 | ||
livenessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 9090 | ||
env: | ||
- name: PORT | ||
value: "9090" | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 64Mi | ||
limits: | ||
cpu: 200m | ||
memory: 128Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: backendservice | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: backendservice | ||
ports: | ||
- name: http | ||
port: 9090 | ||
targetPort: 9090 | ||
|
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 => default/frontend[Deployment] : TCP 8080 | ||
default/frontend[Deployment] => 0.0.0.0-255.255.255.255 : UDP 53 | ||
default/frontend[Deployment] => default/backend[Deployment] : TCP 9090 |
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,67 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: frontend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: frontend | ||
spec: | ||
containers: | ||
- name: server | ||
image: frontend | ||
ports: | ||
- containerPort: 8080 | ||
readinessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 8080 | ||
livenessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 8080 | ||
env: | ||
- name: PORT | ||
value: "8080" | ||
- name: BACKEND_SERVICE_ADDR | ||
value: "backendservice:9090" | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 64Mi | ||
limits: | ||
cpu: 200m | ||
memory: 128Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: frontend | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: frontend | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: frontend-external | ||
spec: | ||
type: LoadBalancer | ||
selector: | ||
app: frontend | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: 8080 |
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,65 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
creationTimestamp: null | ||
name: backend-netpol | ||
spec: | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
app: frontend | ||
ports: | ||
- port: 9090 | ||
protocol: TCP | ||
podSelector: | ||
matchLabels: | ||
app: backendservice | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
status: {} | ||
|
||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
creationTimestamp: null | ||
name: frontend-netpol | ||
spec: | ||
egress: | ||
- ports: | ||
- port: 9090 | ||
protocol: TCP | ||
to: | ||
- podSelector: | ||
matchLabels: | ||
app: backendservice | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
ingress: | ||
- ports: | ||
- port: 8080 | ||
protocol: TCP | ||
podSelector: | ||
matchLabels: | ||
app: frontend | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
status: {} | ||
|
||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
creationTimestamp: null | ||
name: default-deny-in-namespace | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
status: {} | ||
|
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,53 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: backend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: backendservice | ||
template: | ||
metadata: | ||
labels: | ||
app: backendservice | ||
spec: | ||
containers: | ||
- name: server | ||
image: backendservice | ||
ports: | ||
- containerPort: 9090 | ||
readinessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 9090 | ||
livenessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 9090 | ||
env: | ||
- name: PORT | ||
value: "9090" | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 64Mi | ||
limits: | ||
cpu: 200m | ||
memory: 128Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: backendservice | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: backendservice | ||
ports: | ||
- name: http | ||
port: 9090 | ||
targetPort: 9090 | ||
|
3 changes: 3 additions & 0 deletions
3
tests/netpol-diff-example-minimal/diff_output_from_netpol-analysis-example-minimal.csv
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 @@ | ||
source,destination,dir1,dir2,diff-type | ||
default/frontend[Deployment],default/backend[Deployment],TCP 9090,"TCP 9090,UDP 53",changed | ||
0.0.0.0-255.255.255.255,default/backend[Deployment],No Connections,TCP 9090,added |
4 changes: 4 additions & 0 deletions
4
...netpol-diff-example-minimal/diff_output_from_netpol-analysis-example-minimal.md
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,4 @@ | ||
| source | destination | dir1 | dir2 | diff-type | | ||
|--------|-------------|------|------|-----------| | ||
| default/frontend[Deployment] | default/backend[Deployment] | TCP 9090 | TCP 9090,UDP 53 | changed | | ||
| 0.0.0.0-255.255.255.255 | default/backend[Deployment] | No Connections | TCP 9090 | added | |
3 changes: 3 additions & 0 deletions
3
tests/netpol-diff-example-minimal/diff_output_from_netpol-analysis-example-minimal.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 @@ | ||
Connectivity diff: | ||
source: default/frontend[Deployment], destination: default/backend[Deployment], dir1: TCP 9090, dir2: TCP 9090,UDP 53, diff-type: changed | ||
source: 0.0.0.0-255.255.255.255, destination: default/backend[Deployment], dir1: No Connections, dir2: TCP 9090, diff-type: added |
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,67 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: frontend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: frontend | ||
spec: | ||
containers: | ||
- name: server | ||
image: frontend | ||
ports: | ||
- containerPort: 8080 | ||
readinessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 8080 | ||
livenessProbe: | ||
initialDelaySeconds: 10 | ||
httpGet: | ||
path: "/_healthz" | ||
port: 8080 | ||
env: | ||
- name: PORT | ||
value: "8080" | ||
- name: BACKEND_SERVICE_ADDR | ||
value: "backendservice:9090" | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 64Mi | ||
limits: | ||
cpu: 200m | ||
memory: 128Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: frontend | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
app: frontend | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: 8080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: frontend-external | ||
spec: | ||
type: LoadBalancer | ||
selector: | ||
app: frontend | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: 8080 |
Oops, something went wrong.