helmfile.yaml
5.68 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
bases:
- ../common/environments.yaml
---
repositories:
- name: bedag
url: https://bedag.github.io/helm-charts/
releases:
- name: http-support
namespace: {{ .Values.namespace }}
chart: charts/http-support
dependencies:
- chart: bedag/raw
alias: raw
version: {{ $.Values.versions.raw }}
values:
- raw:
resources:
{{- range $redirect_index, $redirect := .Values.redirect }}
{{- if $.Values.istio.enabled }}
- apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: http-support-redirect-{{ $redirect_index }}-{{ index $redirect.hosts 0 }}
spec:
hosts:
{{- $redirect.hosts | toYaml | nindent 18 }}
gateways:
- {{ $.Values.istio.gateway }}
http:
- match:
- uri:
prefix: /
redirect:
redirectCode: 302
authority: {{ $redirect.target }}
{{- end }}
{{- if $.Values.gatewayAPI.enabled }}
- apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: http-support-redirect-{{ $redirect_index }}-{{ index $redirect.hosts 0 }}
spec:
parentRefs:
- name: {{ $.Values.gatewayAPI.gateway }}
hostnames:
{{- $redirect.hosts | toYaml | nindent 18 }}
rules:
- matches:
- path:
type: PathPrefix
value: /
filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 302
hostname: {{ $redirect.target }}
{{- end }}
{{- end }}
- apiVersion: v1
kind: ConfigMap
metadata:
name: http-support-nginx-configs
data:
{{- range $proxy_index, $proxy := .Values.proxy }}
proxy-{{ $proxy_index }}.conf: |-
{{- $proxy.config | nindent 20 }}
{{- end }}
status.conf: |-
server {
server_name _;
listen 80 default;
location /status.html {
return 200 'OK';
add_header Content-Type text/plain;
access_log /dev/null;
}
}
{{- range $proxy_index, $proxy := .Values.proxy }}
{{- if $.Values.istio.enabled }}
- apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: http-support-proxy-{{ $proxy_index }}-{{ index $proxy.frontend.host 0 }}
spec:
hosts:
- {{ $proxy.frontend.host }}
gateways:
- {{ $.Values.gateway }}
http:
- match:
- uri:
prefix: /
rewrite:
authority: {{ $proxy.authority }}
route:
- destination:
port:
number: 80
host: http-support-proxy
headers:
request:
set:
x-frontend-host: {{ $proxy.frontend.host }}
x-frontend-stub: {{ $proxy.frontend.stub }}
x-backend-host: {{ $proxy.backend.host }}
x-backend-stub: {{ $proxy.backend.stub }}
x-backend-address: {{ $proxy.backend.address }}
x-backend-scheme: {{ $proxy.backend.scheme }}
{{- end }}
{{- if $.Values.gatewayAPI.enabled }}
- apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: http-support-proxy-{{ $proxy_index }}-{{ index $proxy.frontend.host 0 }}
spec:
parentRefs:
- name: {{ $.Values.gatewayAPI.gateway }}
hostnames:
- {{- $proxy.frontend.host }}
rules:
- matches:
- path:
type: PathPrefix
value: /
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: x-frontend-host
value: {{ $proxy.frontend.host }}
- name: x-frontend-stub
value: {{ $proxy.frontend.stub }}
- name: x-backend-host
value: {{ $proxy.backend.host }}
- name: x-backend-stub
value: {{ $proxy.backend.stub }}
- name: x-backend-address
value: {{ $proxy.backend.address }}
- name: x-backend-scheme
value: {{ $proxy.backend.scheme }}
{{- end }}
{{- end }}