Skip to content

Commit

Permalink
feat: egress netpols
Browse files Browse the repository at this point in the history
  • Loading branch information
wittdennis committed Dec 27, 2024
1 parent cb76bff commit ee701d8
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ spec:
entrypoint: main
serviceAccountName: foundry-workflows
onExit: exit-handler
podMetadata:
labels:
network-policy/allow-minio-traffic: apply
network-policy/allow-kube-apiserver-traffic: apply
artifactGC:
strategy: OnWorkflowDeletion
serviceAccountName: foundry-workflows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ spec:
workflowSpec:
entrypoint: main
onExit: exit-handler
podMetadata:
labels:
network-policy/allow-minio-traffic: apply
network-policy/allow-kube-apiserver-traffic: apply
artifactGC:
strategy: OnWorkflowDeletion
serviceAccountName: foundry-workflows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ spec:
entrypoint: main
serviceAccountName: foundry-workflows
onExit: exit-handler
podMetadata:
labels:
network-policy/allow-minio-traffic: apply
network-policy/allow-kube-apiserver-traffic: apply
artifactGC:
strategy: OnWorkflowDeletion
serviceAccountName: foundry-workflows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ 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
labels:
network-policy/allow-minio-traffic: apply
network-policy/allow-kube-apiserver-traffic: apply
network-policy/allow-backup-egress: apply
entrypoint: main
onExit: exit-handler
artifactGC:
Expand Down
18 changes: 18 additions & 0 deletions cloud/networking/network-policies/allow-backup-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-backup-egress
spec:
endpointSelector:
matchLabels:
network-policy/allow-backup-egress: apply
egress:
- toFQDNs:
- matchName: "backups92217735.blob.core.windows.net"
toPorts:
- ports:
- port: "443"
protocol: TCP
rules:
http: [{}]
36 changes: 15 additions & 21 deletions cloud/networking/network-policies/allow-kube-apiserver-traffic.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# ---
# 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: [{}]
---
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
48 changes: 21 additions & 27 deletions cloud/networking/network-policies/allow-minio-traffic.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# ---
# 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: [{}]
---
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
56 changes: 28 additions & 28 deletions cloud/networking/network-policies/default-deny-egress.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +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
---
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

0 comments on commit ee701d8

Please sign in to comment.