---
# The server creates one Job per request phase and polls Job/Pod state to drive
# the state machine and rebuild it after a restart.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: repospawner
  namespace: repospawner
rules:
  - apiGroups:
      - batch
    resources:
      - jobs
    verbs:
      - create
      - get
      - list
      - watch
      - delete
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - pods/log
    verbs:
      - get
      - list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: repospawner
  namespace: repospawner
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: repospawner
subjects:
  - kind: ServiceAccount
    name: repospawner
    namespace: repospawner
