apiVersion: v1
kind: Service
metadata:
  name: {{ include "openwa.fullname" . }}
  labels:
    {{- include "openwa.labels" . | nindent 4 }}
    # Marks this Service as the single scrape target. Deliberately NOT in `openwa.labels`: the
    # headless Service must not carry it, or the ServiceMonitor matches both again. The headless
    # Service exists for StatefulSet DNS and sets publishNotReadyAddresses, so scraping it also
    # produces `up=0` for a pod that is still starting.
    openwa.io/scrape-target: "primary"
spec:
  type: {{ .Values.service.type }}
  selector:
    {{- include "openwa.selectorLabels" . | nindent 4 }}
  ports:
    - name: http
      port: {{ .Values.service.port }}
      targetPort: http
