# helm_charts_rethinkdb-proxy-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ template "rethinkdb.fullname" . }}-proxy
  labels:
    app: {{ template "rethinkdb.name" . }}-proxy
    chart: {{ template "rethinkdb.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  annotations:
  {{- if .Values.proxy.service.annotations }}
{{ toYaml .Values.proxy.service.annotations | indent 4 }}
  {{- end }}
spec:
  type: {{ .Values.proxy.service.type }}
{{- if .Values.proxy.service.clusterIP }}
  clusterIP: {{ .Values.proxy.service.clusterIP | quote }}
{{- end }}
{{- if .Values.proxy.service.externalIPs }}
  externalIPs:
{{ toYaml .Values.proxy.service.externalIPs | indent 4 }}
{{- end }}
{{- if .Values.proxy.service.loadBalancerIP }}
  loadBalancerIP: "{{ .Values.proxy.service.loadBalancerIP }}"
{{- end }}
{{- if .Values.proxy.service.loadBalancerSourceRanges }}
  loadBalancerSourceRanges:
{{ toYaml .Values.proxy.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
  ports:
    - port: {{ .Values.ports.driver }}
      targetPort: driver
  selector:
    app: {{ template "rethinkdb.name" . }}-proxy
    release: {{ .Release.Name }}