{{- if .Values.kubeProxy.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "kube-prometheus-stack.fullname" . }}-kube-proxy
  labels:
    app: {{ template "kube-prometheus-stack.name" . }}-kube-proxy
    jobLabel: kube-proxy
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
  namespace: kube-system
spec:
  clusterIP: None
  ports:
    - name: http-metrics
      port: {{ .Values.kubeProxy.service.port }}
      protocol: TCP
      targetPort: {{ .Values.kubeProxy.service.targetPort }}
{{- if .Values.kubeProxy.endpoints }}{{- else }}
  selector:
    {{- if .Values.kubeProxy.service.selector }}
{{ toYaml .Values.kubeProxy.service.selector | indent 4 }}
    {{- else}}
    k8s-app: kube-proxy
    {{- end}}
{{- end }}
  type: ClusterIP
{{- end -}}
