{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if and .Values.kubeControllerManager.enabled .Values.kubeControllerManager.endpoints }}
apiVersion: v1
kind: Endpoints
metadata:
  name: {{ template "kube-prometheus.fullname" . }}-kube-controller-manager
  namespace: {{ .Values.kubeControllerManager.namespace }}
  labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
    app.kubernetes.io/component: kube-controller-manager
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
subsets:
  - addresses:
      {{- range .Values.kubeControllerManager.endpoints }}
      - ip: {{ . }}
      {{- end }}
    ports:
      - name: http-metrics
        port: {{ .Values.kubeControllerManager.service.ports.http }}
        protocol: TCP
{{- end }}
