33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
{{- if .Values.kubecostMetrics }}
|
|
{{- if .Values.kubecostMetrics.exporter }}
|
|
{{- if .Values.kubecostMetrics.exporter.enabled }}
|
|
{{- $prometheusScrape := ternary .Values.kubecostMetrics.exporter.prometheusScrape true (kindIs "bool" .Values.kubecostMetrics.exporter.prometheusScrape) }}
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ template "kubecost.kubeMetricsName" . }}
|
|
labels:
|
|
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
|
|
{{- if (or .Values.kubecostMetrics.exporter.service.annotations $prometheusScrape) }}
|
|
annotations:
|
|
{{- if .Values.kubecostMetrics.exporter.service.annotations }}
|
|
{{ toYaml .Values.kubecostMetrics.exporter.service.annotations | indent 4 }}
|
|
{{- end }}
|
|
{{- if $prometheusScrape }}
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: {{ (quote .Values.kubecostMetrics.exporter.port) | default (quote 9005) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
spec:
|
|
ports:
|
|
- name: tcp-metrics
|
|
port: {{ .Values.kubecostMetrics.exporter.port | default 9005 }}
|
|
protocol: TCP
|
|
targetPort: {{ .Values.kubecostMetrics.exporter.port | default 9005 }}
|
|
selector:
|
|
app: {{ template "kubecost.kubeMetricsName" . }}
|
|
type: ClusterIP
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|