From 066dde111000b6639ccc8e2cdbc6b8f6e0c1c4f1 Mon Sep 17 00:00:00 2001 From: Phan Le Date: Mon, 28 Nov 2022 11:11:18 -0800 Subject: [PATCH] Add PSP yaml longhorn-4003 Signed-off-by: Phan Le --- deploy/podsecuritypolicy.yaml | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 deploy/podsecuritypolicy.yaml diff --git a/deploy/podsecuritypolicy.yaml b/deploy/podsecuritypolicy.yaml new file mode 100644 index 0000000..5e5e937 --- /dev/null +++ b/deploy/podsecuritypolicy.yaml @@ -0,0 +1,61 @@ +apiVersion: policy/v1beta1 +kind: PodSecurityPolicy +metadata: + name: longhorn-psp +spec: + privileged: true + allowPrivilegeEscalation: true + requiredDropCapabilities: + - NET_RAW + allowedCapabilities: + - SYS_ADMIN + hostNetwork: false + hostIPC: false + hostPID: true + runAsUser: + rule: RunAsAny + seLinux: + rule: RunAsAny + fsGroup: + rule: RunAsAny + supplementalGroups: + rule: RunAsAny + volumes: + - configMap + - downwardAPI + - emptyDir + - secret + - projected + - hostPath +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: longhorn-psp-role + namespace: longhorn-system +rules: + - apiGroups: + - policy + resources: + - podsecuritypolicies + verbs: + - use + resourceNames: + - longhorn-psp +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: longhorn-psp-binding + namespace: longhorn-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: longhorn-psp-role +subjects: + - kind: ServiceAccount + name: longhorn-service-account + namespace: longhorn-system + - kind: ServiceAccount + name: default + namespace: longhorn-system