apiVersion: v1
kind: Service
metadata:
  name: {{ include "zot.fullname" . }}
  namespace: {{ .Values.namespace | default .Release.Namespace }}
  labels:
    {{- include "zot.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
  type: {{ .Values.service.type }}
  {{- if and .Values.service.clusterIP ( eq .Values.service.type "ClusterIP" ) }}
  clusterIP: {{ .Values.service.clusterIP }}
  {{- end }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: zot
      protocol: TCP
      name: zot
      {{- if .Values.service.nodePort }}
      nodePort: {{ .Values.service.nodePort }}
      {{- end }}
  selector:
    {{- include "zot.selectorLabels" . | nindent 4 }}
