---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: awx-playbook-integrity-manager-role
rules:
  ##
  ## Base operator rules
  ##
  - apiGroups:
      - ""
      - rbac.authorization.k8s.io
    resources:
      - secrets
      - pods
      - serviceaccounts
      - roles
      - rolebindings
      - services
      - services/finalizers
      - endpoints
      - persistentvolumeclaims
      - events
      - configmaps
      - jobs
      - pods/exec
      - pods/log
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - apps
    resources:
      - deployments
      - daemonsets
      - replicasets
      - statefulsets
      - jobs
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
    - monitoring.coreos.com
    resources:
    - servicemonitors
    verbs:
    - get
    - create
  ##
  ## Rules for tower.ansible.com/v1alpha1, Kind: PlaybookIntegrity
  ##
  - apiGroups:
      - tower.ansible.com
    resources:
      - playbookintegrities
      - playbookintegrities/status
      - playbookintegrities/finalizers
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
#+kubebuilder:scaffold:rules

##
## Rules needed for starting k8s runner job
##

  - apiGroups:
    - apps
    resourceNames:
    - tower-resource-operator
    resources:
    - deployments/finalizers
    verbs:
    - update
  - apiGroups:
    - ""
    resources:
    - pods
    - jobs
    verbs:
    - get
  - apiGroups:
    - apps
    resources:
    - replicasets
    - deployments
    - jobs
    verbs:
    - get
  - apiGroups:
    - tower.ansible.com
    resources:
    - '*'
    verbs:
    - create
    - delete
    - get
    - list
    - patch
    - update
    - watch
  - apiGroups:
    - batch
    resources:
    - '*'
    verbs:
    - create
    - delete
    - get
    - list
    - patch
    - update
    - watch
