apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  annotations:
    # ensure this resource is created before and delete after the deployment to minimise errors during namespace transition
    argocd.argoproj.io/sync-wave: "1"
  name: elasticsearch-metrics-apiserver-resources
rules:
  - apiGroups:
      - custom.metrics.k8s.io
    resources: ["*"]
    verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  annotations:
    # ensure this resource is created before and delete after the deployment to minimise errors during namespace transition
    argocd.argoproj.io/sync-wave: "1"
  name: elasticsearch-metrics-apiserver-resource-reader
rules:
  - apiGroups:
      - ""
    resources:
      - namespaces
      - pods
      - services
    verbs:
      - get
      - list