apiVersion: v1
kind: Service
metadata:
  name: {{ include "woodpecker-server.fullname" . }}
  labels:
    {{- include "woodpecker-server.labels" . | nindent 4 }}
  {{- with .Values.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.service.type }}
  {{- with .Values.service.clusterIP }}
  clusterIP: {{ . }}
  {{- end }}
  {{- with .Values.service.loadBalancerIP }}
  loadBalancerIP: {{ . }}
  {{- end }}
  ports:
    - protocol: TCP
      name: http
      port: {{ .Values.service.port }}
      targetPort: http
    - protocol: TCP
      name: grpc
      port: 9000
      targetPort: grpc
    {{- if .Values.metrics.enabled }}
    - protocol: TCP
      name: metrics
      port: {{ .Values.metrics.port }}
      targetPort: metrics
    {{- end }}

  selector:
    {{- include "woodpecker-server.selectorLabels" . | nindent 4 }}
