{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "keel.name" . }}
  namespace: kube-system
  labels:
    app: {{ template "keel.name" . }}
    chart: {{ template "keel.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  type: {{ .Values.service.type }}
  {{- if .Values.service.clusterIP }}
  clusterIP: {{ .Values.service.clusterIP | quote  }}
  {{- end }}
  ports:
    - port: {{ .Values.service.externalPort }}
  {{- if or (ne .Values.service.type "ClusterIP") (ne .Values.service.clusterIP "None") }}
      targetPort: 9300
  {{- end }}
      protocol: TCP
      name: keel
  selector:
    app: {{ template "keel.name" . }}
  sessionAffinity: None
{{- end }}
