apiVersion: v1
kind: Service
metadata:
  name: {{ template "windocks-sql-proxy.fullname" . }}
  labels:
    app: {{ template "windocks-sql-proxy.name" . }}
    chart: {{ template "windocks-sql-proxy.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  sessionAffinity: ClientIP
  type: {{ .Values.service.type }}
  {{- if and (hasKey .Values.service "loadBalancerIP") (eq .Values.service.type "LoadBalancer") }}
  loadBalancerIP: {{ .Values.service.loadBalancerIP }}
  {{- end }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: {{ .Values.service.targetPort }}
      protocol: TCP
      name: tcp
  selector:
    app: {{ template "windocks-sql-proxy.name" . }}
    release: {{ .Release.Name }}
