apiVersion: v1
kind: Service
metadata:
  name: {{ include "chartmuseum.fullname" . }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
  labels:
{{ include "chartmuseum.labels.standard" . | indent 4 }}
{{- if .Values.service.annotations }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
  - port: {{ .Values.service.externalPort }}
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
    nodePort: {{.Values.service.nodePort}}
{{- else }}
    targetPort: http
{{- end }}
    protocol: TCP
    name: http
  selector:
    app: {{ template "chartmuseum.name" . }}
    release: {{ .Release.Name | quote }}
