blob: 7ddedd938223d38c2895eaabaadf0b5cec885bf1 [file] [log] [blame]
Zack Williams618ab862018-08-03 10:12:54 -07001---
2# Copyright 2018-present Open Networking Foundation
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{{- if .Values.common.rbac }}
17apiVersion: v1
18kind: Namespace
19metadata:
20 name: {{ .Values.common.namespace }}
21
22---
23apiVersion: v1
24kind: ServiceAccount
25metadata:
26 name: {{ .Values.daemonset.serviceAccount }}
27 namespace: {{ .Values.common.namespace }}
28
29---
30apiVersion: rbac.authorization.k8s.io/v1
31kind: ClusterRoleBinding
32metadata:
33 name: local-storage-provisioner-pv-binding
34 namespace: {{ .Values.common.namespace }}
35subjects:
36- kind: ServiceAccount
37 name: {{ .Values.daemonset.serviceAccount }}
38 namespace: {{ .Values.common.namespace }}
39roleRef:
40 kind: ClusterRole
41 name: system:persistent-volume-provisioner
42 apiGroup: rbac.authorization.k8s.io
43
44---
45apiVersion: rbac.authorization.k8s.io/v1
46kind: ClusterRole
47metadata:
48 name: local-storage-provisioner-node-clusterrole
49 namespace: {{ .Values.common.namespace }}
50rules:
51- apiGroups: [""]
52 resources: ["nodes"]
53 verbs: ["get"]
54
55---
56apiVersion: rbac.authorization.k8s.io/v1
57kind: ClusterRoleBinding
58metadata:
59 name: local-storage-provisioner-node-binding
60 namespace: {{ .Values.common.namespace }}
61subjects:
62- kind: ServiceAccount
63 name: {{ .Values.daemonset.serviceAccount }}
64 namespace: {{ .Values.common.namespace }}
65roleRef:
66 kind: ClusterRole
67 name: local-storage-provisioner-node-clusterrole
68 apiGroup: rbac.authorization.k8s.io
69
70{{- if .Values.common.useJobForCleaning }}
71---
72apiVersion: rbac.authorization.k8s.io/v1
73kind: Role
74metadata:
75 name: local-storage-provisioner-jobs-role
76 namespace: {{ .Values.common.namespace }}
77rules:
78- apiGroups:
79 - 'batch'
80 resources:
81 - jobs
82 verbs:
83 - '*'
84
85---
86apiVersion: rbac.authorization.k8s.io/v1
87kind: RoleBinding
88metadata:
89 name: local-storage-provisioner-jobs-rolebinding
90 namespace: {{ .Values.common.namespace }}
91subjects:
92- kind: ServiceAccount
93 name: {{ .Values.daemonset.serviceAccount }}
94 namespace: {{ .Values.common.namespace }}
95roleRef:
96 kind: Role
97 name: local-storage-provisioner
98 apiGroup: rbac.authorization.k8s.io
99
100{{- end }} # if .Values.common.useJobForCleaning
101{{- end }} # if .Values.common.rbac