# https://argoproj.github.io/argo-workflows/workflow-rbac/
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: # kpt-merge: /workflow-role
  name: workflow-role
rules:
  # pod get/watch is used to identify the container IDs of the current pod
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
      - watch
      # pod patch is used to annotate the step's outputs back to controller (e.g. artifact location)
      # This is ONLY needed if the step/task has outputs that are used by another step or task.
      - patch
  # logs get/watch are used to get the pods logs for script outputs, and for log archival
  - apiGroups:
      - ""
    resources:
      - pods/log
    verbs:
      - get
      - watch
  # Only needed if you are running the `k8sapi` executor.
  - apiGroups:
      - ""
    resources:
      - pods/exec
    verbs:
      - create
  # Only needed if you are using ConfigMap-based cache for memoization.
  - apiGroups:
      - ""
    resources:
      - configmaps
    verbs:
      - create
      - get
      - update
  # This allows one workflow to create another.
  # This is only needed for resource templates.
  - apiGroups:
      - argoproj.io
    resources:
      - workflows
    verbs:
      - create
      - get
  # This allows agent pod to update the taskset.
  # This is only needed for http templates.
  - apiGroups:
      - argoproj.io
    resources:
      - workflowtasksets
      - workflowtasksets/finalizers
    verbs:
      - list
      - watch
      - get
      - update
      - patch
