rancher-partner-charts/charts/kasten/k10/6.5.201/templates/prometheus-service.yaml

47 lines
1.6 KiB
YAML

{{/* Template to generate service spec for v0 rest services */}}
{{- if .Values.prometheus.server.enabled -}}
{{- $postfix := default .Release.Name .Values.ingress.urlPath -}}
{{- $os_postfix := default .Release.Name .Values.route.path -}}
{{- $service_port := .Values.prometheus.server.service.servicePort -}}
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "k10.prometheus.service.name" . }}-exp
labels:
{{ include "helm.labels" $ | indent 4 }}
component: {{ include "k10.prometheus.service.name" . }}
run: {{ include "k10.prometheus.service.name" . }}
annotations:
getambassador.io/config: |
---
apiVersion: getambassador.io/v3alpha1
kind: Mapping
name: {{ include "k10.prometheus.service.name" . }}-mapping
{{- if .Values.prometheus.server.baseURL }}
rewrite: /{{ .Values.prometheus.server.baseURL | trimPrefix "/" | trimSuffix "/" }}/
{{- else }}
rewrite: /
{{- end }}
{{- if .Values.route.enabled }}
prefix: /{{ $os_postfix | trimPrefix "/" | trimSuffix "/" }}/prometheus/
{{- else }}
prefix: /{{ $postfix | trimPrefix "/" | trimSuffix "/" }}/prometheus/
{{- end }}
service: {{ include "k10.prometheus.service.name" . }}:{{ $service_port }}
timeout_ms: 15000
hostname: "*"
ambassador_id: [ {{ include "k10.ambassadorId" . }} ]
spec:
ports:
- name: http
protocol: TCP
port: {{ $service_port }}
targetPort: 9090
selector:
app: {{ include "k10.prometheus.name" . }}
component: {{ .Values.prometheus.server.name }}
release: {{ .Release.Name }}
{{- end -}}