apiVersion: v1
kind: ServiceAccount
metadata:
  name: '{{ include "camaraaas-qod-provisioning-api-op-chart.fullname" . }}-svc-account'
  namespace: {{ .Release.Namespace }}
  labels:
  {{- include "camaraaas-qod-provisioning-api-op-chart.labels" . | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: '{{ include "camaraaas-qod-provisioning-api-op-chart.fullname" . }}-cluster-role'
  namespace: {{ .Release.Namespace }}
  labels:
  {{- include "camaraaas-qod-provisioning-api-op-chart.labels" . | nindent 4 }}
rules:
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - get
  - list
  - watch
  - patch
  - create
  - update
- apiGroups:
  - ""
  resources:
  - pods
  - services
  - nodes
  verbs:
  - get
  - list
  - watch
  - patch
  - create
  - update
  - delete
- apiGroups:
  - {{ .Values.customResource.group }}
  resources:
  - {{ .Values.customResource.plural }}
  verbs:
  - get
  - list
  - watch
  - patch
  - create
  - update
  - delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: '{{ include "camaraaas-qod-provisioning-api-op-chart.fullname" . }}-cluster-role-binding'
  labels:
  {{- include "camaraaas-qod-provisioning-api-op-chart.labels" . | nindent 4 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: '{{ include "camaraaas-qod-provisioning-api-op-chart.fullname" . }}-cluster-role'
subjects:
- kind: ServiceAccount
  name: '{{ include "camaraaas-qod-provisioning-api-op-chart.fullname" . }}-svc-account'
  namespace: '{{ .Release.Namespace }}'