{{ if .Values.neo4j.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: neo4j
  labels:
    run: neo4j
  annotations:
  {{- if (eq .Values.provider "aws") }}
    external-dns.alpha.kubernetes.io/hostname: amundsen-neo4j-{{ .Values.environment }}.{{ .Values.dnsZone }}
    service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
    service.beta.kubernetes.io/aws-load-balancer-type: nlb 
  {{- end }}
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
    - port: 7473
      name: neo4j-{{ .Values.environment }}-https
      targetPort: 7473
    - port: 7474
      name: neo4j-{{ .Values.environment }}-http
      targetPort: 7474
    - port: 7687
      name: neo4j-{{ .Values.environment }}-bolt
      targetPort: 7687
    - port: 1337
      name: neo4j-{{ .Values.environment }}-shell
      targetPort: 1337
  selector:
    run: neo4j
{{ end }}