apiVersion: v1
kind: Service
metadata:
  name: {{ include "docker-registry-ui.fullname" . }}-user-interface
  labels:
    app.kubernetes.io/component	: user-interface
    {{- include "docker-registry-ui.labels" . | nindent 4 }}
  {{- with .Values.ui.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  selector:
    app.kubernetes.io/component	: user-interface
    {{- include "docker-registry-ui.labels" . | nindent 4 }}
  type: {{ .Values.ui.service.type }}
  ports:
    - port: {{ .Values.ui.service.port }}
      targetPort: {{ .Values.ui.service.targetPort }}
      protocol: TCP
      name: http
      {{- if (and (eq .Values.ui.service.type "NodePort") .Values.ui.service.nodePort) }}
      nodePort: {{ .Values.ui.service.nodePort }}
      {{- end }}
  {{- if .Values.ui.service.additionalSpec }}
  {{ tpl .Values.ui.service.additionalSpec . | nindent 2 | trim }}
  {{- end }}
