{{- if .Values.service.create }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "hazelcast.serviceName" . }}
  labels:
    app.kubernetes.io/name: {{ template "hazelcast.name" . }}
    helm.sh/chart: {{ template "hazelcast.chart" . }}
    app.kubernetes.io/instance: "{{ .Release.Name }}"
    app.kubernetes.io/managed-by: "{{ .Release.Service }}"
spec:
  type: {{ .Values.service.type }}
  {{- if .Values.service.clusterIP }}
  clusterIP: {{ .Values.service.clusterIP }}
  {{- end }}
  selector:
    app.kubernetes.io/name: {{ template "hazelcast.name" . }}
    app.kubernetes.io/instance: "{{ .Release.Name }}"
    role: hazelcast
  ports:
  - protocol: TCP
    port: {{ .Values.service.port }}
    targetPort: hazelcast
    name: hzport
{{- end -}}
