apiVersion: v1
kind: ServiceAccount
metadata:
  name: cleanup-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cleanup-operator
rules:
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
  - list
  - watch
  - delete
- apiGroups: ["batch", "extensions"]
  resources:
  - jobs
  verbs:
  - delete
  - get
  - list
  - watch

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: cleanup-operator
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cleanup-operator
subjects:
- kind: ServiceAccount
  name: cleanup-operator
  namespace: kube-cleanup-operator
