rtrm HF Staff commited on
Commit
e202f7f
·
unverified ·
1 Parent(s): 36d4b6f

feat(chart): add network policy (#1577)

Browse files
chart/env/prod.yaml CHANGED
@@ -14,6 +14,11 @@ serviceAccount:
14
  create: true
15
  name: huggingchat-prod
16
 
 
 
 
 
 
17
  ingress:
18
  path: "/chat"
19
  annotations:
 
14
  create: true
15
  name: huggingchat-prod
16
 
17
+ networkPolicy:
18
+ enabled: true
19
+ allowedBlocks:
20
+ - 10.0.252.0/25
21
+
22
  ingress:
23
  path: "/chat"
24
  annotations:
chart/templates/network-policy.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if $.Values.networkPolicy.enabled }}
2
+ apiVersion: networking.k8s.io/v1
3
+ kind: NetworkPolicy
4
+ metadata:
5
+ name: {{ include "name" . }}
6
+ namespace: {{ .Release.Namespace }}
7
+ spec:
8
+ egress:
9
+ - ports:
10
+ - port: 53
11
+ protocol: UDP
12
+ to:
13
+ - namespaceSelector:
14
+ matchLabels:
15
+ kubernetes.io/metadata.name: kube-system
16
+ podSelector:
17
+ matchLabels:
18
+ k8s-app: kube-dns
19
+ - to:
20
+ {{- range $ip := .Values.networkPolicy.allowedBlocks }}
21
+ - ipBlock:
22
+ cidr: {{ $ip | quote }}
23
+ {{- end }}
24
+ - to:
25
+ - ipBlock:
26
+ cidr: 0.0.0.0/0
27
+ except:
28
+ - 10.0.0.0/8
29
+ - 172.16.0.0/12
30
+ - 192.168.0.0/16
31
+ - 169.254.169.254/32
32
+ podSelector:
33
+ matchLabels: {{ include "labels.standard" . | nindent 6 }}
34
+ policyTypes:
35
+ - Egress
36
+ {{- end }}
chart/values.yaml CHANGED
@@ -8,6 +8,10 @@ replicas: 3
8
 
9
  domain: huggingface.co
10
 
 
 
 
 
11
  service:
12
  type: NodePort
13
  annotations: { }
 
8
 
9
  domain: huggingface.co
10
 
11
+ networkPolicy:
12
+ enabled: false
13
+ allowedBlocks: []
14
+
15
  service:
16
  type: NodePort
17
  annotations: { }