mirror of https://git.rancher.io/charts
78 lines
2.8 KiB
YAML
78 lines
2.8 KiB
YAML
|
{{- if and .Values.alertmanager.enabled .Values.alertmanager.ingress.enabled }}
|
||
|
{{- $pathType := .Values.alertmanager.ingress.pathType | default "" }}
|
||
|
{{- $serviceName := printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "alertmanager" }}
|
||
|
{{- $servicePort := .Values.alertmanager.service.port -}}
|
||
|
{{- $routePrefix := list .Values.alertmanager.alertmanagerSpec.routePrefix }}
|
||
|
{{- $paths := .Values.alertmanager.ingress.paths | default $routePrefix -}}
|
||
|
{{- $apiIsStable := eq (include "kube-prometheus-stack.ingress.isStable" .) "true" -}}
|
||
|
{{- $ingressSupportsPathType := eq (include "kube-prometheus-stack.ingress.supportsPathType" .) "true" -}}
|
||
|
apiVersion: {{ include "kube-prometheus-stack.ingress.apiVersion" . }}
|
||
|
kind: Ingress
|
||
|
metadata:
|
||
|
name: {{ $serviceName }}
|
||
|
namespace: {{ template "kube-prometheus-stack.namespace" . }}
|
||
|
{{- if .Values.alertmanager.ingress.annotations }}
|
||
|
annotations:
|
||
|
{{ toYaml .Values.alertmanager.ingress.annotations | indent 4 }}
|
||
|
{{- end }}
|
||
|
labels:
|
||
|
app: {{ template "kube-prometheus-stack.name" . }}-alertmanager
|
||
|
{{- if .Values.alertmanager.ingress.labels }}
|
||
|
{{ toYaml .Values.alertmanager.ingress.labels | indent 4 }}
|
||
|
{{- end }}
|
||
|
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
|
||
|
spec:
|
||
|
{{- if $apiIsStable }}
|
||
|
{{- if .Values.alertmanager.ingress.ingressClassName }}
|
||
|
ingressClassName: {{ .Values.alertmanager.ingress.ingressClassName }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
rules:
|
||
|
{{- if .Values.alertmanager.ingress.hosts }}
|
||
|
{{- range $host := .Values.alertmanager.ingress.hosts }}
|
||
|
- host: {{ tpl $host $ }}
|
||
|
http:
|
||
|
paths:
|
||
|
{{- range $p := $paths }}
|
||
|
- path: {{ tpl $p $ }}
|
||
|
{{- if and $pathType $ingressSupportsPathType }}
|
||
|
pathType: {{ $pathType }}
|
||
|
{{- end }}
|
||
|
backend:
|
||
|
{{- if $apiIsStable }}
|
||
|
service:
|
||
|
name: {{ $serviceName }}
|
||
|
port:
|
||
|
number: {{ $servicePort }}
|
||
|
{{- else }}
|
||
|
serviceName: {{ $serviceName }}
|
||
|
servicePort: {{ $servicePort }}
|
||
|
{{- end }}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
{{- else }}
|
||
|
- http:
|
||
|
paths:
|
||
|
{{- range $p := $paths }}
|
||
|
- path: {{ tpl $p $ }}
|
||
|
{{- if and $pathType $ingressSupportsPathType }}
|
||
|
pathType: {{ $pathType }}
|
||
|
{{- end }}
|
||
|
backend:
|
||
|
{{- if $apiIsStable }}
|
||
|
service:
|
||
|
name: {{ $serviceName }}
|
||
|
port:
|
||
|
number: {{ $servicePort }}
|
||
|
{{- else }}
|
||
|
serviceName: {{ $serviceName }}
|
||
|
servicePort: {{ $servicePort }}
|
||
|
{{- end }}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
{{- if .Values.alertmanager.ingress.tls }}
|
||
|
tls:
|
||
|
{{ tpl (toYaml .Values.alertmanager.ingress.tls | indent 4) . }}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|