-
Notifications
You must be signed in to change notification settings - Fork 1
/
metrics-rbac.yaml
43 lines (42 loc) · 1.3 KB
/
metrics-rbac.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#@ load("@ytt:data", "data")
#@ load("config.lib.yaml", "name", "fullName", "chart", "labels", "selectorLabels")
#@ if data.values.serviceMonitor.enabled:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels: #@ labels()
#@ if data.values.serviceMonitor.labels:
#@ data.values.serviceMonitor.labels
#@ end
name: #@ fullName() + "-metrics-role"
namespace: #@ data.values.serviceMonitor.namespace if data.values.serviceMonitor.namespace else data.values.release.namespace
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels: #@ labels()
#@ if data.values.serviceMonitor.labels:
#@ data.values.serviceMonitor.labels
#@ end
name: #@ fullName() + "-metrics-rolebinding"
namespace: #@ data.values.serviceMonitor.namespace if data.values.serviceMonitor.namespace else data.values.release.namespace
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: #@ fullName() + "-metrics-role"
subjects:
- kind: ServiceAccount
name: #@ data.values.serviceMonitor.serviceAccount.name
namespace: #@ data.values.serviceMonitor.serviceAccount.namespace if data.values.serviceMonitor.serviceAccount.namespace else data.values.release.namespace
#@ end