| gio | 2539d9e | 2025-05-22 12:19:30 +0400 | [diff] [blame^] | 1 | {{- if .Values.enablePSP }} |
| 2 | apiVersion: policy/v1beta1 |
| 3 | kind: PodSecurityPolicy |
| 4 | metadata: |
| 5 | name: longhorn-psp |
| 6 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 7 | spec: |
| 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 | --- |
| 33 | apiVersion: rbac.authorization.k8s.io/v1 |
| 34 | kind: Role |
| 35 | metadata: |
| 36 | name: longhorn-psp-role |
| 37 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 38 | namespace: {{ include "release_namespace" . }} |
| 39 | rules: |
| 40 | - apiGroups: |
| 41 | - policy |
| 42 | resources: |
| 43 | - podsecuritypolicies |
| 44 | verbs: |
| 45 | - use |
| 46 | resourceNames: |
| 47 | - longhorn-psp |
| 48 | --- |
| 49 | apiVersion: rbac.authorization.k8s.io/v1 |
| 50 | kind: RoleBinding |
| 51 | metadata: |
| 52 | name: longhorn-psp-binding |
| 53 | labels: {{- include "longhorn.labels" . | nindent 4 }} |
| 54 | namespace: {{ include "release_namespace" . }} |
| 55 | roleRef: |
| 56 | apiGroup: rbac.authorization.k8s.io |
| 57 | kind: Role |
| 58 | name: longhorn-psp-role |
| 59 | subjects: |
| 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 }} |