{{- if and .Values.prometheus.enabled .Values.prometheus.thanosServiceExternal.enabled }} apiVersion: v1 kind: Service metadata: name: {{ template "kube-prometheus-stack.fullname" . }}-thanos-external namespace: {{ template "kube-prometheus-stack.namespace" . }} labels: {{ include "kube-prometheus-stack.labels" . | indent 4 }} {{- if .Values.prometheus.thanosServiceExternal.labels }} {{ toYaml .Values.prometheus.thanosServiceExternal.labels | indent 4 }} {{- end }} {{- if .Values.prometheus.thanosServiceExternal.annotations }} annotations: {{ toYaml .Values.prometheus.thanosServiceExternal.annotations | indent 4 }} {{- end }} spec: type: {{ .Values.prometheus.thanosServiceExternal.type }} {{- if .Values.prometheus.thanosServiceExternal.loadBalancerIP }} loadBalancerIP: {{ .Values.prometheus.thanosServiceExternal.loadBalancerIP }} {{- end }} {{- if .Values.prometheus.thanosServiceExternal.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{- range $cidr := .Values.prometheus.thanosServiceExternal.loadBalancerSourceRanges }} - {{ $cidr }} {{- end }} {{- end }} ports: - name: {{ .Values.prometheus.thanosServiceExternal.portName }} port: {{ .Values.prometheus.thanosServiceExternal.port }} targetPort: {{ .Values.prometheus.thanosServiceExternal.targetPort }} {{- if eq .Values.prometheus.thanosServiceExternal.type "NodePort" }} nodePort: {{ .Values.prometheus.thanosServiceExternal.nodePort }} {{- end }} selector: app.kubernetes.io/name: prometheus prometheus: {{ template "kube-prometheus-stack.fullname" . }}-prometheus {{- end }}