# helm_charts_client-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ template "nats.fullname" . }}-client
  labels:
    app: "{{ template "nats.name" . }}"
    chart: "{{ template "nats.chart" . }}"
    release: {{ .Release.Name | quote }}
    heritage: {{ .Release.Service | quote }}
  {{- if .Values.client.service.annotations }}
  annotations:
{{ toYaml .Values.client.service.annotations | indent 4 }}
  {{- end }}
spec:
  type: {{ .Values.client.service.type }}
  {{- if and (eq .Values.client.service.type "LoadBalancer") .Values.client.service.loadBalancerIP }}
  loadBalancerIP: {{ .Values.client.service.loadBalancerIP }}
  {{- end }}
  ports:
    - port: {{ .Values.client.service.port }}
      targetPort: client
      name: client
      {{- if and (eq .Values.client.service.type "NodePort") (not (empty .Values.client.service.nodePort)) }}
      nodePort: {{ .Values.client.service.nodePort  }}
      {{- end }}
  selector:
    app: "{{ template "nats.name" . }}"
    release: {{ .Release.Name | quote }}