apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: workflows
rules:
  - apiGroups: [""]
    resources: ["configmaps", "services", "secrets", "events"]
    verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
  - apiGroups: ["apps"]
    resources: ["deployments", "deployments/finalizers"] # finalizers are needed for the owner reference of the webhook
    verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
  - apiGroups: ["coordination.k8s.io"]
    resources: ["leases"]
    verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
  - apiGroups: ["admissionregistration.k8s.io"]
    resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"]
    verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
  - apiGroups: ["apiextensions.k8s.io"]
    resources: ["customresourcedefinitions"]
    verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
  - apiGroups: ["workflows.dev"]
    resources: ["*"]
    verbs: ["get", "list", "create", "update", "delete", "deletecollection", "patch", "watch"]
