# grafana_charts_service-metrics.yaml
{{- if or .Values.serviceMonitor.enabled .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "promtail.fullname" . }}-metrics
  namespace: {{ include "promtail.namespaceName" . }}
  labels:
    {{- include "promtail.labels" . | nindent 4 }}
    {{- with .Values.service.labels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- with .Values.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  clusterIP: None
  ports:
    - name: http-metrics
      port: {{ .Values.config.serverPort }}
      targetPort: http-metrics
      protocol: TCP
  selector:
    {{- include "promtail.selectorLabels" . | nindent 4 }}
{{- end }}