apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: ddc-collect
rules:
- apiGroups:
  - ""
  resources:
  - namespaces
  - pods
  - pods/log
  - persistentvolumeclaims
  - resoucesquotas
  - services
  - endpoints
  verbs:
  - get
  - list
- apiGroups:
  - events.k8s.io
  resources:
  - events
  verbs:
  - get
  - list
- apiGroups:
  - ""
  resources:
  - pods/exec
  verbs:
  - create
- apiGroups:
  - batch
  resources:
  - cronjobs
  - jobs
  verbs:
  - get
  - list
- apiGroups:
  - apps
  resources:
  - deployments
  - statefulsets
  - daemonsets
  - replicasets
  verbs:
  - get
  - list
- apiGroups:
  - networking.k8s.io
  resources:
  - ingresses
  verbs:
  - get
  - list
- apiGroups:
  - autoscaling
  resources:
  - horizontalpodautoscalers
  verbs:
  - get
  - list
- apiGroups:
  - policy
  resources:
  - poddisruptionbudgets
  verbs:
  - get
  - list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: ddc-collect
rules:
- apiGroups:
  - ""
  resources:
  - nodes
  - persistentvolumes
  - limitranges
  - resoucesquotas
  - services
  - endpoints
  verbs:
  - get
  - list
- apiGroups:
  - storage.k8s.io
  resources:
  - storageclasses
  verbs:
  - get
  - list
- apiGroups:
  - scheduling.k8s.io
  resources:
  - priorityclasses
  verbs:
  - get
  - list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: ddc-collect
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ddc-collect
subjects:
- kind: ServiceAccount
  name: {{ $.Values.coordinator.serviceAccount }}
  namespace: {{ $.Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: ddc-collect
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: ddc-collect
subjects:
- kind: ServiceAccount
  name: {{ $.Values.coordinator.serviceAccount }}
