apiVersion: v1
kind: Service
metadata:
  name: {{ printf "%s-headless" (include "common.names.fullname" .) }}
  namespace: {{ .Release.Namespace | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  annotations:
    {{- if .Values.commonAnnotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
spec:
  clusterIP: None
  publishNotReadyAddresses: true
  ports:
    - name: http
      protocol: TCP
      port: {{ .Values.containerPorts.http }}
    - name: rpc
      port: {{ .Values.containerPorts.rpc }}
    - name: serflan-tcp
      protocol: TCP
      port: {{ .Values.containerPorts.serfLAN }}
    - name: serflan-udp
      protocol: UDP
      port: {{ .Values.containerPorts.serfLAN }}
    - name: rpc-server
      port: {{ .Values.containerPorts.rpcServer }}
    - name: dns-tcp
      port: {{ .Values.containerPorts.dns }}
    - name: dns-udp
      protocol: UDP
      port: {{ .Values.containerPorts.dns }}
  selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
  sessionAffinity: None
