-
Notifications
You must be signed in to change notification settings - Fork 73
/
ingress.yaml
79 lines (79 loc) · 2.7 KB
/
ingress.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{{- if and (.Values.connect.ingress.enabled) (.Values.connect.create) -}}
{{- $extraPaths := .Values.connect.ingress.extraPaths -}}
{{- $serviceName := .Values.connect.applicationName -}}
{{- $tlsEnabled := .Values.connect.tls.enabled -}}
{{- $apiHttpPort := .Values.connect.api.httpPort -}}
{{- $apiHttpsPort := .Values.connect.api.httpsPort -}}
{{- $pathType := .Values.connect.ingress.pathType -}}
{{- $kubeVersion := .Capabilities.KubeVersion.Version }}
{{ if semverCompare ">= 1.19.0-0" $kubeVersion }}
apiVersion: networking.k8s.io/v1
{{ else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{ else }}
apiVersion: extensions/v1beta1
{{ end }}
kind: Ingress
metadata:
name: {{ template "onepassword-connect.name" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: {{ include "onepassword-connect.chart" . }}
app.kubernetes.io/name: {{ include "onepassword-connect.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.connect.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- template "onepassword-connect.ingress.annotations" . }}
spec:
{{- if .Values.connect.ingress.tls }}
tls:
{{- range .Values.connect.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- if .Values.connect.ingress.ingressClassName }}
ingressClassName: {{ .Values.connect.ingress.ingressClassName }}
{{- end }}
rules:
{{- range .Values.connect.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{ if $extraPaths }}
{{ toYaml $extraPaths | indent 10 }}
{{- end }}
{{- range (.paths | default (list "/")) }}
- path: {{ . }}
{{ if semverCompare ">= 1.19.0-0" $kubeVersion }}
pathType: {{ $pathType }}
{{ end }}
backend:
{{ if semverCompare ">= 1.19.0-0" $kubeVersion }}
service:
{{- if $tlsEnabled }}
name: {{ $serviceName }}
port:
number: {{ $apiHttpsPort }}
{{- else }}
name: {{ $serviceName }}
port:
number: {{ $apiHttpPort }}
{{- end }}
{{ else }}
{{- if $tlsEnabled }}
serviceName: {{ $serviceName }}-https
servicePort: {{ $apiHttpsPort }}
{{- else }}
serviceName: {{ $serviceName }}
servicePort: {{ $apiHttpPort }}
{{- end }}
{{ end }}
{{- end }}
{{- end }}
{{- end }}