{{- if .Values.networkCosts }} {{- if .Values.networkCosts.enabled }} apiVersion: v1 kind: Service metadata: name: {{ template "cost-analyzer.networkCostsName" . }} namespace: {{ .Release.Namespace }} {{- if (or .Values.networkCosts.service.annotations .Values.networkCosts.prometheusScrape) }} annotations: {{- if .Values.networkCosts.service.annotations }} {{ toYaml .Values.networkCosts.service.annotations | indent 4 }} {{- end }} {{- if .Values.networkCosts.prometheusScrape }} prometheus.io/scrape: "true" prometheus.io/port: {{ (quote .Values.networkCosts.port) | default (quote 3001) }} {{- end }} {{- end }} labels: {{ unset (include "cost-analyzer.commonLabels" . | fromYaml) "app" | toYaml | nindent 4 }} app: {{ template "cost-analyzer.networkCostsName" . }} {{- if .Values.networkCosts.service.labels }} {{ toYaml .Values.networkCosts.service.labels | indent 4 }} {{- end }} spec: clusterIP: None ports: - name: metrics port: {{ .Values.networkCosts.port | default 3001 }} protocol: TCP targetPort: {{ .Values.networkCosts.port | default 3001 }} selector: app: {{ template "cost-analyzer.networkCostsName" . }} type: ClusterIP {{- end }} {{- end }}