apiVersion: v1
kind: ServiceAccount
metadata:
  name: mongoclaw
  namespace: mongoclaw
  labels:
    app.kubernetes.io/name: mongoclaw
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: mongoclaw
  namespace: mongoclaw
  labels:
    app.kubernetes.io/name: mongoclaw
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["coordination.k8s.io"]
    resources: ["leases"]
    verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: mongoclaw
  namespace: mongoclaw
  labels:
    app.kubernetes.io/name: mongoclaw
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: mongoclaw
subjects:
  - kind: ServiceAccount
    name: mongoclaw
    namespace: mongoclaw
