apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: manager-role
rules:
  ##
  ## Base operator rules
  ##
  # We need to get namespaces so the operator can read namespaces to ensure they exist
  - apiGroups:
      - ""
    resources:
      - namespaces
    verbs:
      - get
  # We need to manage Helm release secrets
  - apiGroups:
      - ""
    resources:
      - secrets
    verbs:
      - "*"
  # We need to create events on CRs about things happening during reconciliation
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create

  ##
  ## Rules for helm.sigstore.dev/v1alpha1, Kind: Rekor
  ##
  - apiGroups:
      - helm.sigstore.dev
    resources:
      - rekors
      - rekors/status
      - rekors/finalizers
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - ""
    resources:
      - pods
      - services
      - services/finalizers
      - serviceaccounts
      - endpoints
      - persistentvolumeclaims
      - events
      - configmaps
      - secrets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - apps
    resources:
      - deployments
      - daemonsets
      - replicasets
      - statefulsets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
  - apiGroups:
      - networking.k8s.io
    resources:
      - ingresses
      - daemonsets
      - replicasets
      - statefulsets
    verbs:
      - create
      - delete
      - get
      - list
      - patch
      - update
      - watch
#+kubebuilder:scaffold:rules
