apiVersion: v1
kind: Service
metadata:
  name: {{ template "xray-server.fullname" . }}
  labels:
    app: {{ template "xray.name" . }}
    chart: {{ template "xray.chart" . }}
    component: {{ .Values.server.name }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
spec:
  type: {{ .Values.server.service.type }}
{{- if .Values.server.loadBalancerSourceRanges }}
  loadBalancerSourceRanges:
{{ toYaml .Values.server.loadBalancerSourceRanges | indent 4 }}
{{- end }}
  ports:
  - port: {{ .Values.server.externalPort }}
    protocol: TCP
    name: http
    targetPort: {{ .Values.server.internalPort }}
  selector:
    app: {{ template "xray.name" . }}
    component: {{ .Values.server.name }}
    release: {{ .Release.Name }}