-
Notifications
You must be signed in to change notification settings - Fork 199
/
20-ingress.yaml
112 lines (106 loc) · 3.45 KB
/
20-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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{{- $_ := set . "Version" ( splitList "/" .Values.global.github_ref | last ) }}
{{- if eq .Version "main" }}
{{- $_ := set . "VersionURLNormalized" "v2" }}
{{- else }}
{{- $_ := set . "VersionURLNormalized" ( printf "%s" .Version | lower | replace "+" "-plus-" | replace "_" "-u-" ) }}
{{- end }}
{{- $_ := set . "VersionDNSNormalized" ( printf "%s" .Version | lower | replace "+" "-plus-" | replace "_" "-u-" | replace "." "-dot-" ) }}
{{- $host := pluck .Values.werf.env .Values.host | first | default .Values.host._default }}
{{- if hasPrefix "review" .Values.werf.env }}
{{- $host = ( printf "%s.%s" .Values.werf.env (pluck "dev" .Values.host | first | default .Values.host._default ) | lower ) }}
{{- end }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}-configurator
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Original-URI $request_uri;
set $configurator_selected_page $1;
ssi on;
ssi_silent_errors on;
{{ include "rewrites" . | indent 6 }}
{{- if eq .Values.werf.env "production" }}
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
{{- else }}
nginx.ingress.kubernetes.io/auth-url: http://basic-auth.kube-basic-auth.svc.cluster.local/werfio
{{- end }}
spec:
tls:
- hosts:
- {{ $host }}
- ru.{{ $host }}
{{- if eq .Values.werf.env "production" }}
- www.{{ $host }}
{{- end }}
secretName: tls-{{ $host }}
rules:
- host: {{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}/configurator(?:/(.*))?$
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
port:
name: http
- host: ru.{{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}/configurator(?:/(.*))?$
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
port:
name: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Original-URI $request_uri;
ssi on;
ssi_silent_errors on;
{{ include "rewrites" . | indent 6 }}
{{- if eq .Values.werf.env "production" }}
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
{{- else }}
nginx.ingress.kubernetes.io/auth-url: http://basic-auth.kube-basic-auth.svc.cluster.local/werfio
{{- end }}
spec:
tls:
- hosts:
- {{ $host }}
- ru.{{ $host }}
{{- if eq .Values.werf.env "production" }}
- www.{{ $host }}
{{- end }}
secretName: tls-{{ $host }}
rules:
- host: {{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
port:
name: http
- host: ru.{{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
port:
name: http
---