{{- if .Values.webui.enabled -}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "falcosidekick.fullname" . }}-ui
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "falcosidekick.labels" . | nindent 4 }}
    app.kubernetes.io/component: ui
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ include "falcosidekick.fullname" . }}-ui
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "falcosidekick.labels" . | nindent 4 }}
    app.kubernetes.io/component: ui
rules: []
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ include "falcosidekick.fullname" . }}-ui
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "falcosidekick.labels" . | nindent 4 }}
    app.kubernetes.io/component: ui
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ include "falcosidekick.fullname" . }}-ui
subjects:
- kind: ServiceAccount
  name: {{ include "falcosidekick.fullname" . }}-ui
{{- end }}
