Skip to content

Commit

Permalink
feat: revisit network policies
Browse files Browse the repository at this point in the history
  • Loading branch information
wittdennis committed Dec 23, 2024
1 parent d331c8f commit 3c2c9d4
Show file tree
Hide file tree
Showing 18 changed files with 157 additions and 162 deletions.
3 changes: 3 additions & 0 deletions argo-apps/cloud/ddb-proxy.cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec:
values: |
replicaCount: 2
podLabels:
networking.k8s.io/apply-network-policy: allow-world-http-ingress
network-policy/allow-dndbeyond-egress: apply
resources:
requests:
cpu: 50m
Expand Down
3 changes: 3 additions & 0 deletions argo-apps/cloud/foundry-code-and-quest-app.cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
storage:
className: longhorn
size: 5Gi
podLabels:
network-policy/allow-world-http-ingress: apply
network-policy/allow-world-https-egress: apply
resources:
requests:
cpu: 40m
Expand Down
3 changes: 3 additions & 0 deletions argo-apps/cloud/foundry-saltysausage-app.cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
storage:
className: longhorn
size: 5Gi
podLabels:
network-policy/allow-world-http-ingress: apply
network-policy/allow-world-https-egress: apply
resources:
requests:
cpu: 40m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ spec:
concurrencyPolicy: "Replace"
startingDeadlineSeconds: 0
successfulJobsHistoryLimit: 7
workflowMetadata:
labels:
network-policy/allow-minio-traffic: apply
workflowSpec:
podMetadata:
network-policy/allow-minio-traffic: apply
network-policy/allow-kube-apiserver-traffic: apply
entrypoint: main
onExit: exit-handler
artifactGC:
Expand Down
4 changes: 4 additions & 0 deletions cloud/custom-resources/argo-workflows/scale-workload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ spec:
serviceAccountName: foundry-workflows
podGC:
strategy: OnWorkflowSuccess
podMetadata:
labels:
network-policy/allow-kube-apiserver-traffic: apply
network-policy/allow-minio-traffic: apply
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down
19 changes: 19 additions & 0 deletions cloud/networking/network-policies/allow-dndbeyond-egress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: allow-dndbeyond-egress
spec:
endpointSelector:
matchLabels:
network-policy/allow-dndbeyond-egress: apply
egress:
- toFQDNs:
- matchPattern: "*.dndbeyond.com"
- matchName: "dndbeyond.com"
toPorts:
- ports:
- port: "443"
protocol: TCP
rules:
http: [{}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: allow-kube-apiserver-traffic
spec:
endpointSelector:
matchLabels:
network-policy/allow-kube-apiserver-traffic: apply
ingress:
- fromEntities:
- kube-apiserver
egress:
- toEntities:
- kube-apiserver
toPorts:
- ports:
- port: "443"
protocol: TCP
rules:
http: [{}]
27 changes: 27 additions & 0 deletions cloud/networking/network-policies/allow-minio-traffic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: allow-minio-traffic
spec:
endpointSelector:
matchLabels:
network-policy/allow-minio-traffic: apply
ingress:
- fromEndpoints:
- matchLabels:
app: minio
v1.min.io/tenant: default
io.kubernetes.pod.namespace: storage
egress:
- toEndpoints:
- matchLabels:
app: minio
v1.min.io/tenant: default
io.kubernetes.pod.namespace: storage
toPorts:
- ports:
- port: "9000"
protocol: TCP
rules:
http: [{}]
16 changes: 16 additions & 0 deletions cloud/networking/network-policies/allow-world-http-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: allow-world-http-ingress
spec:
endpointSelector:
matchLabels:
network-policy/allow-world-http-ingress: apply
ingress:
- fromEndpoints:
- matchLabels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/component: controller
io.kubernetes.pod.namespace: ingress-nginx
18 changes: 18 additions & 0 deletions cloud/networking/network-policies/allow-world-https-egress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: allow-world-https-egress
spec:
endpointSelector:
matchLabels:
network-policy/allow-world-https-egress: apply
egress:
- toEntities:
- world
toPorts:
- ports:
- port: "443"
protocol: TCP
rules:
http: [{}]
33 changes: 0 additions & 33 deletions cloud/networking/network-policies/ddb-proxy-egress.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions cloud/networking/network-policies/ddb-proxy-ingress.yaml

This file was deleted.

28 changes: 28 additions & 0 deletions cloud/networking/network-policies/default-deny-egress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: default-deny-egress
namespace: foundry
spec:
endpointSelector: {}
egress:
# DNS
- toEndpoints:
- matchLabels:
io.kubernetes.pod.namespace: kube-system
k8s-app: kube-dns
toPorts:
- ports:
- port: "53"
protocol: UDP
rules:
dns:
- matchPattern: "*"
# ingress-nginx
- toEndpoints:
- matchLabels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/component: controller
io.kubernetes.pod.namespace: ingress-nginx
9 changes: 9 additions & 0 deletions cloud/networking/network-policies/default-deny-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: default-deny-ingress
spec:
endpointSelector: {}
ingress:
- {}
32 changes: 0 additions & 32 deletions cloud/networking/network-policies/foundry-egress-salty.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions cloud/networking/network-policies/foundry-egress.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions cloud/networking/network-policies/foundry-ingress-salty.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions cloud/networking/network-policies/foundry-ingress.yaml

This file was deleted.

0 comments on commit 3c2c9d4

Please sign in to comment.