kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: onedev
rules:
  - apiGroups: [""]
    resources: ["namespaces"]
    verbs: ["get", "list", "create", "delete"] #require this permission to run builds in isolated namespaces
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["clusterrolebindings"]
    verbs: ["get", "list", "create", "delete"] #require this permission to bind cluster roles to service account of running builds
  - apiGroups: [""]
    resources: ["nodes"]
    verbs: ["get", "list", "patch"] #require this permission to label nodes with build cache properties to increase cache hit rate
  - apiGroups: [""]
    resources: ["services", "pods", "pods/log", "pods/exec", "secrets", "configmaps", "events"]
    verbs: ["get", "list", "watch", "create", "patch", "delete"] #require this permission to run builds as pods
  - apiGroups: ["apps"]
    resources: ["deployments"]
    verbs: ["get", "list", "create", "patch", "delete"] #require this permission to run builds as pods