apiVersion: v1
kind: Service
metadata:
  labels:
    app: {{ template "burrow.name" . }}
    chart: {{ template "burrow.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  name:  {{ template "burrow.fullname" . }}-grpc
spec:
  type: {{ .Values.rpcGRPC.service.type }}
{{- if .Values.rpcGRPC.service.loadBalance }}
  sessionAffinity: ClientIP
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: 600
{{- end }}
  ports:
    - name: grpc
      port: {{ .Values.rpcGRPC.service.port }}
      targetPort: grpc
      protocol: TCP
  selector:
    app: {{ template "burrow.name" . }}
    release: {{ .Release.Name }}
{{- if not .Values.rpcGRPC.service.loadBalance }}
    nodeNumber: {{ .Values.rpcGRPC.service.node | quote }}
{{- end }}
