rancher-partner-charts/charts/kubecost/cost-analyzer/2.0.2/templates/prometheus-server-ingress.yaml

46 lines
1.6 KiB
YAML

{{- if and (.Values.global.prometheus.enabled) (.Values.prometheus.server.enabled) (.Values.prometheus.server.ingress.enabled) }}
{{- $serviceName := include "prometheus.server.fullname" . }}
{{- $servicePort := .Values.prometheus.server.service.servicePort -}}
{{- $extraPaths := .Values.prometheus.server.ingress.extraPaths -}}
{{- $pathType := .Values.prometheus.server.ingress.pathType -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- if .Values.prometheus.server.ingress.annotations }}
annotations:
{{ toYaml .Values.prometheus.server.ingress.annotations | indent 4 }}
{{- end }}
labels:
{{- include "prometheus.server.labels" . | nindent 4 }}
{{- range $key, $value := .Values.prometheus.server.ingress.extraLabels }}
{{ $key }}: {{ $value }}
{{- end }}
name: {{ template "prometheus.server.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.prometheus.server.ingress.className }}
ingressClassName: {{ .Values.prometheus.server.ingress.className }}
{{- end }}
rules:
{{- range .Values.prometheus.server.ingress.hosts }}
{{- $url := splitList "/" . }}
- host: {{ first $url }}
http:
paths:
{{ if $extraPaths }}
{{ toYaml $extraPaths | indent 10 }}
{{- end }}
- path: /{{ rest $url | join "/" }}
pathType: {{ $pathType }}
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- end -}}
{{- if .Values.prometheus.server.ingress.tls }}
tls:
{{ toYaml .Values.prometheus.server.ingress.tls | indent 4 }}
{{- end -}}
{{- end }}