{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  labels:
    app: {{ template "kubewatch.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "kubewatch.fullname" . }}
rules:
  - apiGroups:
      - ""
    resources:
      - pods
      - namespaces
      - services
      - deployments
      - replicationcontrollers
      - replicasets
      - daemonsets
    verbs:
      - list
      - watch
{{- end -}}