{{ if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: {{ template "searchlight.fullname" . }}
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    app: "{{ template "searchlight.name" . }}"
    heritage: "{{ .Release.Service }}"
    release: "{{ .Release.Name }}"
rules:
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - "*"
- apiGroups:
  - extensions
  resources:
  - thirdpartyresources
  verbs:
  - "*"
- apiGroups:
  - monitoring.appscode.com
  resources: ["*"]
  verbs: ["*"]
- apiGroups: ["storage.k8s.io"]
  resources: ["*"]
  verbs: ["get"]
- apiGroups: [""]
  resources:
  - secrets
  - componentStatuses
  - persistentVolumes
  - persistentVolumeClaims
  verbs: ["get"]
- apiGroups: [""]
  resources:
  - pods
  - nodes
  - namespaces
  verbs: ["get", "list", "watch"]
- apiGroups: [""]
  resources:
  - events
  verbs: ["create", "list"]
{{ end }}
