apiVersion: v1
kind: Service
metadata:
  name: {{ template "orientdb.fullname" . }}-headless
  labels:
    app: {{ template "orientdb.name" . }}
    chart: {{ template "orientdb.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  type: ClusterIP
  ports:
    - port: {{ .Values.service.orientHttp }}
      targetPort: http
      name: http
    - port: {{ .Values.service.hazelcast }}
      targetPort: hazelcast
      name: hazelcast
    - port: {{ .Values.service.orientBinary }}
      targetPort: binary
      name: binary
    - port: {{ .Values.service.gremlinWebsocket }}
      targetPort: gremlin
      name: gremlin
      
  # headless service
  clusterIP: None    
  selector:
    app: {{ template "orientdb.name" . }}
    release: {{ .Release.Name }}
---
apiVersion: v1
kind: Service
metadata:
  name: {{ template "orientdb.fullname" . }}-svc
  labels:
    app: {{ template "orientdb.name" . }}
    chart: {{ template "orientdb.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.orientHttp }}
      targetPort: http
      name: http
    - port: {{ .Values.service.hazelcast }}
      targetPort: hazelcast
      name: hazelcast
    - port: {{ .Values.service.orientBinary }}
      targetPort: binary
      name: binary
    - port: {{ .Values.service.gremlinWebsocket }}
      targetPort: gremlin
      name: gremlin
  selector:
    app: {{ template "orientdb.name" . }}
    release: {{ .Release.Name }}
