{{- if .Values.dashboard.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "traefik.fullname" . }}-dashboard
  labels:
    app: {{ template "traefik.name" . }}
    chart: {{ template "traefik.chart" . }}
    release: {{ .Release.Name | quote }}
    heritage: {{ .Release.Service | quote }}
  annotations:
  {{- if .Values.dashboard.service }}
  {{- range $key, $value := .Values.dashboard.service.annotations }}
    {{ $key }}: {{ $value | quote }}
  {{- end }}
  {{- end }}
spec:
  type: {{ .Values.dashboard.serviceType | default ("ClusterIP") }}
  selector:
    app: {{ template "traefik.name" . }}
    release: {{ .Release.Name }}
  ports:
  - name: dashboard-http
    port: 80
    targetPort: 8080
{{- end }}
