---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: k8s-spot-rescheduler
rules:
  # For leader election
  - apiGroups:
      - ""
    resources:
      - endpoints
    verbs:
      - get
      - update
      - create
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create

  # For listing and watching items
  - apiGroups:
      - ""
    resources:
      - nodes
      - pods
      - replicasets
      - replicationcontrollers
      - services
      - statefulsets
      - poddisruptionbudgets
      - persistentvolumes
      - persistentvolumeclaims
    verbs:
      - list
      - get
      - watch
  - apiGroups:
    - apps
    resources:
       - statefulsets
    verbs:
      - list
      - get
      - watch
  - apiGroups:
    - extensions
    resources:
       - replicasets
    verbs:
      - list
      - get
      - watch
  - apiGroups:
    - policy
    resources:
       - poddisruptionbudgets
    verbs:
      - list
      - get
      - watch

  # For rescheduling pods
  - apiGroups:
    - ""
    resources:
       - nodes
    verbs:
      - update
  - apiGroups:
    - ""
    resources:
       - pods/eviction
    verbs:
      - create
