{{- $app := .Values.server }}
{{- if and $app.relabel.enabled (empty $app.relabel.configMap) }}
{{- $ctx := dict "helm" . "appKey" "server" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ $fullname }}-relabelconfig
  namespace: {{ $ns }}
  labels: {{ include "vm.labels" $ctx | nindent 4 }}
data:
  relabel.yml: |{{ toYaml $app.relabel.config | nindent 4 }}
{{- end }}
