apiVersion: v1
kind: Service
metadata:
  name: {{ include "karpenter.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "karpenter.labels" . | nindent 4 }}
  {{- if or .Values.additionalAnnotations .Values.service.annotations }}
  annotations:
  {{- with .Values.additionalAnnotations }}
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- with .Values.service.annotations }}
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- end }}
spec:
  type: ClusterIP
  ports:
    - name: http-metrics
      port: {{ .Values.controller.metrics.port }}
      targetPort: http-metrics
      protocol: TCP
  selector:
    {{- include "karpenter.selectorLabels" . | nindent 4 }}
