aboutsummaryrefslogtreecommitdiffstats
path: root/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus/ingress.yaml
blob: 2a9c4e6080f4ff7a7fe44a0b67ee327be3538be9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{{- if and .Values.prometheus.enabled .Values.prometheus.ingress.enabled }}
{{- $serviceName := printf "%s-%s" (include "prometheus-operator.fullname" .) "prometheus" }}
{{- $servicePort := .Values.prometheus.service.port -}}
{{- $routePrefix := list .Values.prometheus.prometheusSpec.routePrefix }}
{{- $paths := .Values.prometheus.ingress.paths | default $routePrefix -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{ else }}
apiVersion: extensions/v1beta1
{{ end -}}
kind: Ingress
metadata:
{{- if .Values.prometheus.ingress.annotations }}
  annotations:
{{ toYaml .Values.prometheus.ingress.annotations | indent 4 }}
{{- end }}
  name: {{ $serviceName }}
  namespace: {{ template "prometheus-operator.namespace" . }}
  labels:
    app: {{ template "prometheus-operator.name" . }}-prometheus
{{ include "prometheus-operator.labels" . | indent 4 }}
{{- if .Values.prometheus.ingress.labels }}
{{ toYaml .Values.prometheus.ingress.labels | indent 4 }}
{{- end }}
spec:
  rules:
  {{- if .Values.prometheus.ingress.hosts }}
  {{- range $host := .Values.prometheus.ingress.hosts }}
    - host: {{ tpl $host $ }}
      http:
        paths:
  {{- range $p := $paths }}
          - path: {{ tpl $p $ }}
            backend:
              serviceName: {{ $serviceName }}
              servicePort: {{ $servicePort }}
  {{- end -}}
  {{- end -}}
  {{- else }}
    - http:
        paths:
  {{- range $p := $paths }}
          - path: {{ tpl $p $ }}
            backend:
              serviceName: {{ $serviceName }}
              servicePort: {{ $servicePort }}
  {{- end -}}
  {{- end -}}
  {{- if .Values.prometheus.ingress.tls }}
  tls:
{{ toYaml .Values.prometheus.ingress.tls | indent 4 }}
  {{- end -}}
{{- end -}}