apiVersion: v1
kind: Service
metadata:
  name: soft-serve
  namespace: {{ .Release.Namespace }}
  {{ if eq .Values.serviceType "LoadBalancer" }}
  annotations:
    {{ if .Values.reservedIP }}
    metallb.universe.tf/loadBalancerIPs: {{ .Values.reservedIP }}
    {{ end }}
    {{ if .Values.addressPool }}
    metallb.universe.tf/address-pool: {{ .Values.addressPool }}
    {{ end }}
  {{ end }}
spec:
  type: {{ .Values.serviceType }}
  selector:
    app: soft-serve
  ports:
  - name: ssh
    port: {{ .Values.port }}
    protocol: TCP
  - name: http
    port: 80 # TODO(gio): make configurable
    targetPort: http
    protocol: TCP
