Skip to content

Commit a674588

Browse files
authored
feat(helm): add NetworkPolicy template to allow traffic from tenant namespaces (#702)
1 parent b0c34e0 commit a674588

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{{- if .Values.networkPolicy.enabled }}
2+
{{- if and .Values.networkPolicy.ingressFromTenants.enabled (gt (len .Values.tenants) 0) }}
3+
---
4+
apiVersion: networking.k8s.io/v1
5+
kind: NetworkPolicy
6+
metadata:
7+
name: allow-traffic-from-burrito-tenants
8+
labels:
9+
{{- with .Values.global.metadata.labels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- with .Values.networkPolicy.metadata.labels }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
annotations:
16+
{{- with .Values.global.metadata.annotations }}
17+
{{- toYaml . | nindent 4 }}
18+
{{- end }}
19+
{{- with .Values.networkPolicy.metadata.annotations }}
20+
{{- toYaml . | nindent 4 }}
21+
{{- end }}
22+
spec:
23+
podSelector: {}
24+
policyTypes:
25+
- Ingress
26+
ingress:
27+
# Allow all traffic from tenant namespaces
28+
{{- range .Values.tenants }}
29+
{{- if .namespace.create }}
30+
- from:
31+
- namespaceSelector:
32+
matchLabels:
33+
kubernetes.io/metadata.name: {{ .namespace.name }}
34+
{{- end }}
35+
{{- end }}
36+
{{- with .Values.networkPolicy.ingressFromTenants.additionalIngressRules }}
37+
{{- toYaml . | nindent 4 }}
38+
{{- end }}
39+
{{- end }}
40+
{{- end }}

deploy/charts/burrito/values.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ config:
103103
repository: ghcr.io/padok-team/burrito
104104
tag: "" # By default use Chart's appVersion
105105
pullPolicy: Always
106-
106+
107107
# -- Command to run in the Burrito runner container
108108
command: ["burrito"]
109109
# -- Arguments to pass to the Burrito runner container
@@ -485,3 +485,18 @@ tenants: []
485485
# annotations:
486486
# iam.cloud.provider/role: cloud-provider-role
487487
# labels: {}
488+
489+
# Network Policy configuration
490+
networkPolicy:
491+
# -- Enable/Disable Network Policy creation
492+
enabled: false
493+
# -- Metadata configuration for Network Policies
494+
metadata:
495+
labels: {}
496+
annotations: {}
497+
# -- Network policy to allow ingress traffic from all the tenant namespaces to the release namespace
498+
ingressFromTenants:
499+
# -- Enable/Disable tenant ingress network policy
500+
enabled: true
501+
# -- Additional ingress rules for tenant namespaces network policy
502+
additionalIngressRules: []

0 commit comments

Comments
 (0)