{{- if and .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled -}}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "datadog.clusterAgent.fullname" . }}-metrics-api
  labels:
    app: "{{ template "datadog.fullname" . }}"
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    release: {{ .Release.Name | quote }}
    heritage: {{ .Release.Service | quote }}
spec:
  type: ClusterIP
  selector:
    app: {{ template "datadog.clusterAgent.fullname" . }}
  ports:
  - port: 443
    name: metricsapi
    protocol: TCP
{{ end }}
