{{- if .Values.webui.enabled -}}
{{- if eq .Values.webui.existingSecret "" }}
---
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "falcosidekick.fullname" . }}-ui
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "falcosidekick.labels" . | nindent 4 }}
    app.kubernetes.io/component: ui
type: Opaque
data:
  {{- if .Values.webui.user }}
  FALCOSIDEKICK_UI_USER: "{{ .Values.webui.user | b64enc}}"
  {{-  end }}
  {{- if .Values.webui.redis.password }}
  FALCOSIDEKICK_UI_REDIS_PASSWORD: "{{ .Values.webui.redis.password | b64enc}}"
  {{-  end }}
{{- end }}
{{- if eq .Values.webui.redis.existingSecret "" }}
---
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "falcosidekick.fullname" . }}-ui-redis
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "falcosidekick.labels" . | nindent 4 }}
    app.kubernetes.io/component: ui
type: Opaque
data:
  {{- if .Values.webui.redis.password }}
  REDIS_ARGS: "{{ printf "--requirepass %s" .Values.webui.redis.password | b64enc}}"
  {{-  end }}
{{- end }}
{{- end }}