{{- $app := .Values.vmauth }}
{{- if $app.enabled }}
{{- $ctx := dict "helm" . "appKey" (list "vmauth" "spec") }}
{{- $fullname := include "vm.cr.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
  {{- with $app.annotations }}
  annotations: {{ toYaml . | nindent 4 }}
  {{- end  }}
  name: {{ $fullname }}
  namespace: {{ $ns }}
  {{- $_ := set $ctx "extraLabels" ($app.labels | default dict) }}
  labels: {{ include "vm.labels" $ctx | nindent 4 }}
  {{- $_ := unset $ctx "extraLabels" }}
spec: {{ include "vm.auth.spec" $ctx | nindent 2 }}
{{- end }}
