{{- if .Values.rbacEnable }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "fullname" . }}
  labels:
    app: {{ include "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
    lenses.io/app: {{ include "fullname" . }}
    lenses.io/app.type: lenses-cluster-role
rules:
- apiGroups: [""]
  resources:
    - namespaces
    - persistentvolumes
    - persistentvolumeclaims
  verbs: 
    - list
    - watch
    - get
    - create
- apiGroups: ["", "extensions", "apps"]
  resources:
    - pods
    - deployments
    - ingresses
    - secrets
    - statefulsets
  verbs: 
    - list
    - watch
    - get
    - update
    - create
    - delete
    - patch
- apiGroups: [""]
  resources:
    - replicasets
  verbs: 
    - list
    - watch
    - get    
- apiGroups: [""]
  resources:
    - events
  verbs: 
    - list
    - watch
    - get           
{{- end }}

{{- if .Values.rbacEnable }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "fullname" . }}
  labels:
    app: {{ include "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
    lenses.io/app: {{ include "fullname" . }}
    lenses.io/app.type: lenses-cluster-role
rules:
- apiGroups: [""]
  resources:
    - namespaces
    - persistentvolumes
    - persistentvolumeclaims
  verbs: 
    - list
    - watch
    - get
    - create
- apiGroups: ["", "extensions", "apps"]
  resources:
    - pods
    - deployments
    - ingresses
    - secrets
    - statefulsets
    - services
  verbs: 
    - list
    - watch
    - get
    - update
    - create
    - delete
    - patch
- apiGroups: [""]
  resources:
    - replicasets
  verbs: 
    - list
    - watch
    - get    
- apiGroups: [""]
  resources:
    - events
  verbs: 
    - list
    - watch
    - get           
{{- end }}

Add permissions for K8s service objects and kafka security protocol for K8s processors
Add permissions for K8s service objects and kafka security protocol for K8s processors
