Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / common / roles-wrapper / templates / role.yaml
1 {{/*
2 # Copyright © 2020 Orange
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
17 {{- $dot := . -}}
18 {{- range $role_type := $dot.Values.roles }}
19 ---
20 apiVersion: rbac.authorization.k8s.io/v1
21 kind: Role
22 metadata:
23   name: {{ printf "%s-%s" (include "common.release" $dot) $role_type }}
24   namespace: {{ include "common.namespace" $dot }}
25 rules:
26 {{-   if eq $role_type "read" }}
27 - apiGroups:
28   - "" # "" indicates the core API group
29   - apps
30   - batch
31   - extensions
32   resources:
33   - pods
34   - deployments
35   - deployments/status
36   - jobs
37   - jobs/status
38   - statefulsets
39   - replicasets
40   - replicasets/status
41   - daemonsets
42   verbs:
43   - get
44   - watch
45   - list
46 {{-   else  }}
47 {{-     if eq $role_type "create" }}
48 - apiGroups:
49   - "" # "" indicates the core API group
50   - apps
51   - batch
52   - extensions
53   resources:
54   - pods
55   - deployments
56   - deployments/status
57   - jobs
58   - jobs/status
59   - statefulsets
60   - replicasets
61   - replicasets/status
62   - daemonsets
63   - secrets
64   - services
65   verbs:
66   - get
67   - watch
68   - list
69 - apiGroups:
70   - "" # "" indicates the core API group
71   - apps
72   resources:
73   - statefulsets
74   - configmaps
75   verbs:
76   - patch
77 - apiGroups:
78   - "" # "" indicates the core API group
79   - apps
80   resources:
81   - deployments
82   - secrets
83   - services
84   - pods
85   verbs:
86   - create
87 - apiGroups:
88   - "" # "" indicates the core API group
89   - apps
90   resources:
91   - pods
92   - persistentvolumeclaims
93   - secrets
94   - deployments
95   - services
96   verbs:
97   - delete
98 - apiGroups:
99   - "" # "" indicates the core API group
100   - apps
101   resources:
102   - pods/exec
103   verbs:
104   - create
105 - apiGroups:
106   - cert-manager.io
107   resources:
108   - certificates
109   verbs:
110   - create
111   - delete
112 {{-     else }}
113 # if you don't match read or create, then you're not allowed to use API
114 # except to see basic information about yourself
115 - apiGroups:
116   - authorization.k8s.io
117   resources:
118   - selfsubjectaccessreviews
119   - selfsubjectrulesreviews
120   verbs:
121   - create
122 {{-     end }}
123 {{-   end }}
124 {{- end }}