apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-git-backend-service
  labels:
    app.kubernetes.io/component: git-backend
    app.kubernetes.io/instance: {{ .Release.Name }}
    chart: {{ template "gerrit-replica.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    {{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels  | indent 4 }}
    {{- end }}
  {{- if .Values.gitBackend.service.additionalAnnotations }}
  annotations:
{{ toYaml .Values.gitBackend.service.additionalAnnotations  | indent 4 }}
  {{- end }}
spec:
  {{ with .Values.gitBackend.service }}
  {{- if .loadBalancerSourceRanges -}}
  loadBalancerSourceRanges:
{{- range .loadBalancerSourceRanges }}
    - {{ . | quote }}
{{- end }}
  {{- end }}
  ports:
  - name: http
    port: {{ .http.port }}
    targetPort: 80
  type: {{ .type }}
  externalTrafficPolicy: {{ .externalTrafficPolicy }}
  {{- end }}
  selector:
    app.kubernetes.io/component: git-backend
    app.kubernetes.io/instance: {{ .Release.Name }}
