rancher-partner-charts/charts/kubecost/cost-analyzer/templates/cost-analyzer-network-costs...

32 lines
1.0 KiB
YAML

{{- if .Values.networkCosts }}
{{- if .Values.networkCosts.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "cost-analyzer.networkCostsName" . }}
{{- 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" . }}
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 }}