blob: 61c452b48b0b49f59caa4c3204ba2b848e121229 [file] [log] [blame]
Andreas Geisslercde4a782024-02-28 16:08:06 +01001{{- /*
2Copyright VMware, Inc.
3SPDX-License-Identifier: APACHE-2.0
4*/}}
5
6{{- if and (include "common.capabilities.psp.supported" .) .Values.podSecurityPolicy.create }}
7apiVersion: policy/v1beta1
8kind: PodSecurityPolicy
9metadata:
10 name: {{ include "mongodb.fullname" . }}
11 namespace: {{ include "mongodb.namespace" . | quote }}
12 labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13 {{- if .Values.commonAnnotations }}
14 annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
15 {{- end }}
16spec:
17{{- if .Values.podSecurityPolicy.spec }}
18{{ include "common.tplvalues.render" ( dict "value" .Values.podSecurityPolicy.spec "context" $ ) | nindent 2 }}
19{{- else }}
20 allowPrivilegeEscalation: {{ .Values.podSecurityPolicy.allowPrivilegeEscalation }}
21 fsGroup:
22 rule: 'MustRunAs'
23 ranges:
24 - min: {{ .Values.podSecurityContext.fsGroup }}
25 max: {{ .Values.podSecurityContext.fsGroup }}
26 hostIPC: false
27 hostNetwork: false
28 hostPID: false
29 privileged: {{ .Values.podSecurityPolicy.privileged }}
30 readOnlyRootFilesystem: false
31 requiredDropCapabilities:
32 - ALL
33 runAsUser:
34 rule: 'MustRunAs'
35 ranges:
36 - min: {{ .Values.containerSecurityContext.runAsUser }}
37 max: {{ .Values.containerSecurityContext.runAsUser }}
38 seLinux:
39 rule: 'RunAsAny'
40 supplementalGroups:
41 rule: 'MustRunAs'
42 ranges:
43 - min: {{ .Values.containerSecurityContext.runAsUser }}
44 max: {{ .Values.containerSecurityContext.runAsUser }}
45 volumes:
46 - 'configMap'
47 - 'secret'
48 - 'emptyDir'
49 - 'persistentVolumeClaim'
50{{- end }}
51{{- end }}