Skip to content

Commit 6b4d70d

Browse files
authored
feat: whitelist all ingress traffic if team network policies are disa… (#1540)
1 parent 0e52f19 commit 6b4d70d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

charts/team-ns/templates/networkpolicy.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22
{{- $v := .Values | merge (dict) }}
33
{{- $prometheus := dig "managedMonitoring" "prometheus" false $v }}
44
{{- $alertmng := dig "managedMonitoring" "alertmanager" false $v }}
5-
{{- if and (not (eq $v.teamId "admin")) (dig "networkPolicy" "ingressPrivate" true $v) }}
5+
{{- if (not (dig "networkPolicy" "ingressPrivate" true $v)) }}
6+
---
7+
# If team network policies are disabled then we whitelist all traffic to prevent undesired blocking while deploying team workloads
8+
kind: NetworkPolicy
9+
apiVersion: networking.k8s.io/v1
10+
metadata:
11+
name: default-ingress-allow-all
12+
labels: {{- include "team-ns.chart-labels" $ | nindent 4 }}
13+
spec:
14+
podSelector:
15+
matchLabels: {}
16+
ingress:
17+
- from:
18+
- namespaceSelector: {}
19+
{{- else if and (not (eq $v.teamId "admin")) (dig "networkPolicy" "ingressPrivate" true $v) }}
620
---
721
apiVersion: networking.k8s.io/v1
822
kind: NetworkPolicy

tests/fixtures/env/teams.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ teamConfig:
3030
prometheus: true
3131
networkPolicy:
3232
egressPublic: true
33-
ingressPrivate: true
33+
ingressPrivate: false
3434
oidc:
3535
groupMapping: somesecretvalue
3636
resourceQuota:

0 commit comments

Comments
 (0)