---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: {{ include "dragonfly-operator.fullname" . }}-manager-role
  labels:
    {{- include "dragonfly-operator.labels" . | nindent 4 }}
    app.kubernetes.io/component: rbac
rules:
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
      - patch
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - ""
    resources:
      - services
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - apps
    resources:
      - statefulsets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - dragonflydb.io
    resources:
      - dragonflies
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - dragonflydb.io
    resources:
      - dragonflies/finalizers
    verbs:
      - update
  - apiGroups:
      - dragonflydb.io
    resources:
      - dragonflies/status
    verbs:
      - get
      - patch
      - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: {{ include "dragonfly-operator.fullname" . }}-metrics-reader
  labels:
    {{- include "dragonfly-operator.labels" . | nindent 4 }}
    app.kubernetes.io/component: kube-rbac-proxy
rules:
  - nonResourceURLs:
      - /metrics
    verbs:
      - get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: {{ include "dragonfly-operator.fullname" . }}-proxy-role
  labels:
    {{- include "dragonfly-operator.labels" . | nindent 4 }}
    app.kubernetes.io/component: kube-rbac-proxy
rules:
  - apiGroups:
      - authentication.k8s.io
    resources:
      - tokenreviews
    verbs:
      - create
  - apiGroups:
      - authorization.k8s.io
    resources:
      - subjectaccessreviews
    verbs:
      - create