---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: manager-role
rules:
  ##
  ## Base operator rules
  ##
  - apiGroups:
      - ""
    resources:
      - secrets
      - pods
      - pods/exec
      - pods/log
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - apps
    resources:
      - deployments
      - daemonsets
      - replicasets
      - statefulsets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  ##
  ## Rules Ported from old namespaced role
  ##
  - apiGroups:
    - ""
    resources:
    - pods
    - daemonsets
    - services
    - endpoints
    - persistentvolumeclaims
    - virtualmachineinstances
    - events
    - configmaps
    - secrets
    - pods/log
    verbs:
    - '*'
  - apiGroups:
    - ""
    resources:
    - namespaces
    verbs:
    - get
  - apiGroups:
    - apps
    resources:
    - deployments
    - daemonsets
    - replicasets
    - statefulsets
    - deployments/finalizers
    verbs:
    - '*'
  - apiGroups:
    - monitoring.coreos.com
    resources:
    - servicemonitors
    verbs:
    - get
    - create
  - apiGroups:
    - kubevirt.io
    resources:
    - virtualmachineinstances
    verbs:
    - '*'
  - apiGroups:
    - ripsaw.cloudbulldozer.io
    resources:
    - '*'
    verbs:
    - '*'
  - apiGroups:
    - batch
    - extensions
    resources:
    - jobs
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
  - apiGroups:
    - policy
    resources:
    - podsecuritypolicies
    verbs:
    - use
    resourceNames:
    - privileged
  - apiGroups:
    - security.openshift.io
    resourceNames:
    - privileged
    resources:
    - securitycontextconstraints
    verbs:
    - use
  - apiGroups:
    - hyperfoil.io
    resources:
    - hyperfoils
    verbs:
    - '*'
  - apiGroups:
    - networking.k8s.io
    resources:
    - networkpolicies
    verbs:
    - get
    - list
    - watch
    - create
    - update
    - patch
    - delete
  - apiGroups:
    - k8s.cni.cncf.io
    resources:
    - network-attachment-definitions
    verbs:
    - get
    - list
    - watch

  ##
  ## Rules from old cluster role
  ##
  - apiGroups:
    - ""
    resources:
    - nodes
    verbs:
    - get
    - list
    - patch

  ##
  ## Rules from kube-virt
  ##
  - apiGroups:
    - rbac.authorization.k8s.io
    resources:
    - roles
    - rolebindings
    - clusterroles
    - clusterrolebindings
    - daemonsets
    verbs:
    - '*'
  - apiGroups:
    - apps
    resources:
    - daemonsets
    verbs:
    - get
    - list
  - apiGroups:
    - rbac.authorization.k8s.io
    resources:
    - nodes
    verbs:
    - get
    - list
  - apiGroups:
      - subresources.kubevirt.io
    resources:
      - virtualmachineinstances/console
      - virtualmachineinstances/vnc
    verbs:
      - get
  - apiGroups:
      - kubevirt.io
    resources:
      - virtualmachineinstances
      - virtualmachines
      - virtualmachineinstancepresets
      - virtualmachineinstancereplicasets
    verbs:
      - get
      - delete
      - create
      - update
      - patch
      - list
      - watch
      - deletecollection
  - apiGroups: [""]
    resources:
      - configmaps
    resourceNames:
      - kubevirt-config
    verbs:
      - update
      - get
      - patch

  ##
  ## Rules from kernel-cache-drop
  ##
  - apiGroups:
    - ''
    resources:
    - nodes
    - pods
    verbs:
    - get
    - list
  - apiGroups:
    - apps
    resources:
    - daemonsets
    verbs:
    - get
    - list

  ##
  ## Rules for ripsaw.cloudbulldozer.io/v1alpha1, Kind: Benchmark
  ##
  - apiGroups:
      - ripsaw.cloudbulldozer.io
    resources:
      - benchmarks
      - benchmarks/status
      - benchmarks/finalizers
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
#+kubebuilder:scaffold:rules
