Skip to content

Commit 8079cf5

Browse files
committed
feat: Optional default networkPolicy
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
1 parent ff81f41 commit 8079cf5

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.controllerplugin.networkPolicy.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: {{ include "cvmfs-csi.controllerplugin.fullname" . }}
6+
spec:
7+
egress:
8+
{{- with .Values.controllerplugin.networkPolicy.egress }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
ingress:
12+
{{- with .Values.controllerplugin.networkPolicy.ingress }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
podSelector:
16+
matchLabels:
17+
{{- include "cvmfs-csi.controllerplugin.matchLabels" . | nindent 6 }}
18+
policyTypes:
19+
- Egress
20+
- Ingress
21+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.nodeplugin.networkPolicy.enabled -}}
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: {{ include "cvmfs-csi.nodeplugin.fullname" . }}
6+
spec:
7+
egress:
8+
{{- with .Values.nodeplugin.networkPolicy.egress }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
ingress:
12+
{{- with .Values.nodeplugin.networkPolicy.ingress }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
podSelector:
16+
matchLabels:
17+
{{- include "cvmfs-csi.nodeplugin.matchLabels" . | nindent 6 }}
18+
policyTypes:
19+
- Egress
20+
- Ingress
21+
{{- end }}

deployments/helm/cvmfs-csi/values.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,33 @@ nodeplugin:
215215
# Whether to use this ServiceAccount in Node plugin DaemonSet.
216216
use: false
217217

218+
219+
# Should a networkPolicy be generated for the nodeplugin
220+
networkPolicy:
221+
enabled: false
222+
# no ingress is required for this service
223+
ingress: []
224+
# The minimum egress ports required to function are:
225+
# DNS (53/udp, 53/tcp)
226+
# HTTP and HTTPS servers (DIRECT)
227+
# Your proxy server ports maybe:
228+
# 1080/tcp is SOCKS5
229+
# 3128/tcp is Squid
230+
egress:
231+
- ports:
232+
- port: 80
233+
protocol: TCP
234+
- port: 443
235+
protocol: TCP
236+
- port: 53
237+
protocol: TCP
238+
- port: 53
239+
protocol: UDP
240+
- port: 1080
241+
protocol: TCP
242+
- port: 3128
243+
protocol: TCP
244+
218245
# CSI Controller plugin Deployment configuration.
219246
#
220247
# CVMFS CSI supports volume provisioning, however the provisioned volumes only
@@ -284,6 +311,27 @@ controllerplugin:
284311
# If not, it is expected they are already present.
285312
create: true
286313

314+
# Should a networkPolicy be generated for the controller
315+
networkPolicy:
316+
enabled: false
317+
# no ingress is required for this service
318+
ingress: []
319+
# The minimum egress ports required to function are:
320+
# DNS (53/udp, 53/tcp)
321+
# API server (80/tcp, 443/tcp, 6443/tcp) NOTE: OKD and Openshift use 6443/tcp
322+
egress:
323+
- ports:
324+
- port: 80
325+
protocol: TCP
326+
- port: 443
327+
protocol: TCP
328+
- port: 53
329+
protocol: TCP
330+
- port: 53
331+
protocol: UDP
332+
- port: 6443
333+
protocol: TCP
334+
287335
# Log verbosity level.
288336
# See https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md
289337
# for description of individual verbosity levels.

0 commit comments

Comments
 (0)