{{- if .Values.rbacEnable }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  namespace: default
  name: {{ .Values.serviceAccountName }}
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
rules:
- apiGroups: ["*"]
  resources: ["nodes","nodes/proxy"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["*"]
  resources: ["services","pods","deployments", "events", "endpoints"]
  verbs: ["*"]
- apiGroups: ["*"]
  resources: ["persistentvolumes","persistentvolumeclaims"]
  verbs: ["*"]
- apiGroups: ["storage.k8s.io"]
  resources: ["storageclasses"]
  verbs: ["*"]
- nonResourceURLs: ["/metrics"]
  verbs: ["get"]
{{- end }}

{{- if .Values.rbacEnable }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  namespace: default
  name: {{ .Values.serviceAccountName }}
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
rules:
- apiGroups: ["*"]
  resources: ["nodes","nodes/proxy"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["*"]
  resources: ["namespaces","services","pods","deployments", "events", "endpoints"]
  verbs: ["*"]
- apiGroups: ["*"]
  resources: ["persistentvolumes","persistentvolumeclaims"]
  verbs: ["*"]
- apiGroups: ["storage.k8s.io"]
  resources: ["storageclasses"]
  verbs: ["*"]
- nonResourceURLs: ["/metrics"]
  verbs: ["get"]
{{- end }}

Update operator to have permission to query namespaces
Update operator to have permission to query namespaces

Signed-off-by: kmova <6a28dfa88869c0f71365518480e309e6698873e0@openebs.io>
