8392e8733754e721c6cf7ee152af625c4ad10b6e
[ta/caas-security.git] / rbac_manifests / caas-infra-psp.yaml
1 ---
2 # Copyright 2019 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: extensions/v1beta1
17 kind: PodSecurityPolicy
18 metadata:
19   name: caas-infra
20 spec:
21   privileged: true
22   readOnlyRootFilesystem: false
23   hostNetwork: true
24   hostPorts:
25   - min: 0
26     max: 65535
27   volumes:
28     - 'emptyDir'
29     - 'hostPath'
30     - 'persistentVolumeClaim'
31     - 'configMap'
32     - 'secret'
33     - 'rbd'
34   seLinux:
35     rule: RunAsAny
36   supplementalGroups:
37     rule: RunAsAny
38   runAsUser:
39     rule: RunAsAny
40   fsGroup:
41     rule: RunAsAny
42   allowedCapabilities:
43     - NET_BIND_SERVICE
44     - ALL
45     - IPC_LOCK
46     - SYS_RESOURCE
47     - SYS_PTRACE
48     - SYS_ADMIN
49     - NET_ADMIN
50     - NET_RAW
51 ---
52 apiVersion: rbac.authorization.k8s.io/v1
53 kind: ClusterRole
54 metadata:
55   name: caas:infra-psp
56 rules:
57 - apiGroups:     ['extensions']
58   resources:     ['podsecuritypolicies']
59   verbs:         ['use']
60   resourceNames: ['caas-infra']
61 ---
62 apiVersion: rbac.authorization.k8s.io/v1
63 kind: ClusterRoleBinding
64 metadata:
65   name: caas:infra-psp
66 roleRef:
67   kind: ClusterRole
68   name: caas:infra-psp
69   apiGroup: rbac.authorization.k8s.io
70 subjects:
71 # Authorize system:nodes group to be able to create mirror pods
72 - kind: Group
73   apiGroup: rbac.authorization.k8s.io
74   name: system:nodes
75 - kind: ServiceAccount
76   name: default
77   namespace: kube-system