apiVersion: v1
kind: Service
metadata:
  name: {{ include "azure-api-management-gateway.instanceDiscoveryService" . }}
  namespace: {{ .Release.Namespace | quote }}
  labels:
    {{- include "azure-api-management-gateway.labels" . | nindent 4 }}
  annotations:
    azure.apim.kubernetes.io/notes: "Headless service being used for instance discovery of SHGW"
  {{- with .Values.service.annotations }}
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  clusterIP: None
  type: ClusterIP
  ports:
    - port: {{ .Values.service.ports.instance.synchronization }}
      targetPort: rate-limit-dc
      protocol: UDP
      name: rate-limit-discovery
    - port: {{ .Values.service.ports.instance.heartbeat }}
      targetPort: dc-heartbeat
      protocol: UDP
      name: discovery-heartbeat
  selector:
    {{- include "azure-api-management-gateway.selectorLabels" . | nindent 6 }}
