12345678910111213141516171819202122232425 |
- {{- if and (empty .Values.vmauth.configSecretName) .Values.vmauth.enabled }}
- {{- $ctx := dict "helm" . "appKey" "vmauth" "style" "plain" }}
- apiVersion: v1
- kind: Secret
- metadata:
- name: {{ include "vm.plain.fullname" $ctx }}
- namespace: {{ include "vm.namespace" $ctx }}
- labels: {{ include "vm.labels" $ctx | nindent 4 }}
- type: Opaque
- data:
- {{- $config := .Values.vmauth.config }}
- {{- $urlMap := ($config.unauthorized_user).url_map | default list }}
- {{- range $appKey := list "vmselect" "vminsert" }}
- {{- $app := index $.Values $appKey }}
- {{- $service := $app.service }}
- {{- if and $app.enabled $service.enabled }}
- {{- $_ := set $ctx "appKey" $appKey }}
- {{- $url := include "vm.url" $ctx }}
- {{- $path := printf "/%s/.*" (trimPrefix "vm" $appKey) }}
- {{- $urlMap = append $urlMap (dict "src_paths" (list $path) "url_prefix" $url "discover_backend_ips" true) }}
- {{- end }}
- {{- end }}
- {{- $_ := set $config.unauthorized_user "url_map" $urlMap }}
- auth.yml: | {{ toYaml $config | b64enc | nindent 4 }}
- {{- end }}
|