Skip to content

Commit

Permalink
fix: close egress from sessions except for the release namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
olevski committed Nov 21, 2024
1 parent e9b11aa commit 1572506
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions helm-chart/renku/templates/network-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -974,3 +974,108 @@ spec:
ports:
- protocol: TCP
port: http
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-all-egress-from-sessions-v1
spec:
egress: []
podSelector:
matchLabels:
app.kubernetes.io/component: jupyterserver
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: amalthea
policyTypes:
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-all-egress-from-sessions-v2
spec:
egress: []
podSelector:
matchLabels:
app.kubernetes.io/created-by: controller-manager
app.kubernetes.io/name: AmaltheaSession
policyTypes:
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-only-egress-for-sessions-that-target-this-namespace-v1
spec:
egress:
- to:
- namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: In
values:
- {{ .Release.Namespace | quote }}
podSelector:
matchLabels:
app.kubernetes.io/component: jupyterserver
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: amalthea
policyTypes:
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-only-egress-for-sessions-that-target-this-namespace-v2
spec:
egress:
- to:
- namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: In
values:
- {{ .Release.Namespace | quote }}
podSelector:
matchLabels:
app.kubernetes.io/created-by: controller-manager
app.kubernetes.io/name: AmaltheaSession
policyTypes:
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-only-egress-for-sessions-for-name-resolution-v1
spec:
egress:
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
podSelector:
matchLabels:
app.kubernetes.io/component: jupyterserver
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: amalthea
policyTypes:
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-only-egress-for-sessions-for-name-resolution-v2
spec:
egress:
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
podSelector:
matchLabels:
app.kubernetes.io/created-by: controller-manager
app.kubernetes.io/name: AmaltheaSession
policyTypes:
- Egress

0 comments on commit 1572506

Please sign in to comment.