apiVersion: v1
kind: Service
metadata:
  name: {{ template "rabbitmq.fullname" . }}-headless
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "rabbitmq.name" . }}
    chart: {{ template "rabbitmq.chart" .  }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
spec:
  clusterIP: None
  ports:
  - name: epmd
    port: 4369
    targetPort: epmd
  - name: amqp
    port: {{ .Values.service.port }}
    targetPort: amqp
{{- if .Values.rabbitmq.tls.enabled }}
  - name: amqp-tls
    port: {{ .Values.service.tlsPort }}
    targetPort: amqp-tls
{{- end }}
  - name: dist
    port: {{ .Values.service.distPort }}
    targetPort: dist
  - name: stats
    port: {{ .Values.service.managerPort }}
    targetPort: stats
  selector:
    app: {{ template "rabbitmq.name" . }}
    release: "{{ .Release.Name }}"
