blob: a2dfc05bef368a418609773d2f4df342db1c6151 [file] [log] [blame]
gioc9b92b12025-05-22 08:57:18 +04001{{- if .Values.enablePSP }}
2apiVersion: policy/v1beta1
3kind: PodSecurityPolicy
4metadata:
5 name: longhorn-psp
6 labels: {{- include "longhorn.labels" . | nindent 4 }}
7spec:
8 privileged: true
9 allowPrivilegeEscalation: true
10 requiredDropCapabilities:
11 - NET_RAW
12 allowedCapabilities:
13 - SYS_ADMIN
14 hostNetwork: false
15 hostIPC: false
16 hostPID: true
17 runAsUser:
18 rule: RunAsAny
19 seLinux:
20 rule: RunAsAny
21 fsGroup:
22 rule: RunAsAny
23 supplementalGroups:
24 rule: RunAsAny
25 volumes:
26 - configMap
27 - downwardAPI
28 - emptyDir
29 - secret
30 - projected
31 - hostPath
32---
33apiVersion: rbac.authorization.k8s.io/v1
34kind: Role
35metadata:
36 name: longhorn-psp-role
37 labels: {{- include "longhorn.labels" . | nindent 4 }}
38 namespace: {{ include "release_namespace" . }}
39rules:
40- apiGroups:
41 - policy
42 resources:
43 - podsecuritypolicies
44 verbs:
45 - use
46 resourceNames:
47 - longhorn-psp
48---
49apiVersion: rbac.authorization.k8s.io/v1
50kind: RoleBinding
51metadata:
52 name: longhorn-psp-binding
53 labels: {{- include "longhorn.labels" . | nindent 4 }}
54 namespace: {{ include "release_namespace" . }}
55roleRef:
56 apiGroup: rbac.authorization.k8s.io
57 kind: Role
58 name: longhorn-psp-role
59subjects:
60- kind: ServiceAccount
61 name: longhorn-service-account
62 namespace: {{ include "release_namespace" . }}
63- kind: ServiceAccount
64 name: default
65 namespace: {{ include "release_namespace" . }}
66{{- end }}