blob: f43d0b9bb6012fa3498875bfe9795e9494dd7ce0 [file] [log] [blame]
Shad Ansari0a4637a2022-05-11 12:20:59 -07001# Copyright 2020-present Open Networking Foundation
2# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
3
4{{- if .Values.ingress.enabled -}}
5{{- $fullName := include "person-detection-app.fullname" . -}}
6{{- $svcPort := .Values.service.port -}}
7{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
8 {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
9 {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
10 {{- end }}
11{{- end }}
12{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
13apiVersion: networking.k8s.io/v1
14{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
15apiVersion: networking.k8s.io/v1beta1
16{{- else -}}
17apiVersion: extensions/v1beta1
18{{- end }}
19kind: Ingress
20metadata:
21 name: {{ $fullName }}
22 labels:
23 {{- include "person-detection-app.labels" . | nindent 4 }}
24 {{- with .Values.ingress.annotations }}
25 annotations:
26 {{- toYaml . | nindent 4 }}
27 {{- end }}
28spec:
29 {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
30 ingressClassName: {{ .Values.ingress.className }}
31 {{- end }}
32 {{- if .Values.ingress.tls }}
33 tls:
34 {{- range .Values.ingress.tls }}
35 - hosts:
36 {{- range .hosts }}
37 - {{ . | quote }}
38 {{- end }}
39 secretName: {{ .secretName }}
40 {{- end }}
41 {{- end }}
42 rules:
43 {{- range .Values.ingress.hosts }}
44 - host: {{ .host | quote }}
45 http:
46 paths:
47 {{- range .paths }}
48 - path: {{ .path }}
49 {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
50 pathType: {{ .pathType }}
51 {{- end }}
52 backend:
53 {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
54 service:
55 name: {{ $fullName }}
56 port:
57 number: {{ $svcPort }}
58 {{- else }}
59 serviceName: {{ $fullName }}
60 servicePort: {{ $svcPort }}
61 {{- end }}
62 {{- end }}
63 {{- end }}
64{{- end }}