{{ $serviceType := .Values.issueBot.service.type }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "issueBot.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "lor_e.labels" . | nindent 4 }}
    {{- include "lor_e.issueBotSelectorLabels" . | nindent 4 }}
spec:
  type: {{ $serviceType }}
  ports:
    - port: {{ .Values.issueBot.service.ports.api }}
      targetPort: {{ .Values.issueBot.containerPort }}
      protocol: TCP
      {{- if eq "NodePort" $serviceType }}
      nodePort: {{ .Values.issueBot.service.ports.api }}
      {{- end }}
      name: ib-api
    - port: {{ .Values.issueBot.service.ports.metrics }}
      targetPort: {{ .Values.issueBot.metricsPort }}
      protocol: TCP
      {{- if eq "NodePort" $serviceType }}
      nodePort: {{ .Values.issueBot.service.ports.metrics }}
      {{- end }}
      name: ib-metric
  selector: {{- include "lor_e.issueBotSelectorLabels" . | nindent 4 }}
