# services/maintenance/ariadne-rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: ariadne-job-spawner
rules:
  - apiGroups: ["batch"]
    resources:
      - jobs
      - cronjobs
    verbs:
      - get
      - list
      - watch
      - create
  - apiGroups: [""]
    resources:
      - events
      - pods
      - pods/log
    verbs:
      - get
      - list
      - watch
  - apiGroups: ["apps"]
    resources:
      - daemonsets
      - deployments
      - statefulsets
    verbs:
      - get
      - list
      - watch
      - delete
  - apiGroups: ["apps"]
    resources:
      - deployments/scale
      - statefulsets/scale
    verbs:
      - get
      - patch
      - update
  - apiGroups: [""]
    resources:
      - persistentvolumeclaims
      - persistentvolumes
    verbs:
      - get
      - list
      - watch
      - delete
  - apiGroups: ["longhorn.io"]
    resources:
      - volumes
    verbs:
      - get
      - list
      - watch
      - delete
  - apiGroups: [""]
    resources:
      - nodes
      - namespaces
    verbs:
      - get
      - list
      - watch
  - apiGroups: [""]
    resources:
      - pods/exec
    verbs:
      - get
      - create
  - apiGroups: ["kustomize.toolkit.fluxcd.io"]
    resources:
      - kustomizations
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: ariadne-job-spawner
subjects:
  - kind: ServiceAccount
    name: ariadne
    namespace: maintenance
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ariadne-job-spawner
