apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: {{ include "secrets-operator.fullname" . }}-manager-role
  labels:
  {{- include "secrets-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - create
  - delete
  - get
  - list
  - update
  - watch
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - create
  - delete
  - get
  - list
  - update
  - watch
- apiGroups:
  - apps
  resources:
  - deployments
  verbs:
  - get
  - list
  - update
  - watch
- apiGroups:
  - secrets.infisical.com
  resources:
  - infisicalsecrets
  verbs:
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
- apiGroups:
  - secrets.infisical.com
  resources:
  - infisicalsecrets/finalizers
  verbs:
  - update
- apiGroups:
  - secrets.infisical.com
  resources:
  - infisicalsecrets/status
  verbs:
  - get
  - patch
  - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ include "secrets-operator.fullname" . }}-manager-rolebinding
  labels:
    app.kubernetes.io/component: rbac
    app.kubernetes.io/created-by: k8-operator
    app.kubernetes.io/part-of: k8-operator
  {{- include "secrets-operator.labels" . | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: '{{ include "secrets-operator.fullname" . }}-manager-role'
subjects:
- kind: ServiceAccount
  name: '{{ include "secrets-operator.fullname" . }}-controller-manager'
  namespace: '{{ .Release.Namespace }}'