Skip to content

Commit f63a248

Browse files
committed
chore(gateway): add route for gateway
1 parent 1facdc6 commit f63a248

4 files changed

Lines changed: 95 additions & 20 deletions

File tree

charts/gateway/templates/drycc-certificate.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ metadata:
55
name: drycc-certificate
66
spec:
77
dnsNames:
8-
{{- range .Values.domainPrefixs }}
9-
- {{printf "%s.%s" . $.Values.global.platformDomain}}
8+
{{- range $app := .Values.apps }}
9+
{{- if $app.hostname }}
10+
- {{ tpl $app.hostname $ }}
11+
{{- end }}
1012
{{- end }}
1113
issuerRef:
1214
kind: Issuer

charts/gateway/templates/drycc-gateway.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@ metadata:
55
spec:
66
gatewayClassName: {{ .Values.global.gatewayClass }}
77
listeners:
8-
- name: http
9-
port: 80
10-
protocol: HTTP
8+
{{- range $index, $app := .Values.apps }}
9+
- name: {{ printf "%s-%v-%d" $app.protocol $app.port $index | lower }}
10+
port: {{ $app.port }}
11+
{{- if $app.hostname }}
12+
hostname: {{ tpl $app.hostname $ }}
13+
{{- end }}
14+
protocol: {{ $app.protocol }}
1115
allowedRoutes:
1216
namespaces:
1317
from: All
14-
{{- if .Values.global.certManagerEnabled}}
15-
- name: https
18+
{{- if and (eq $app.protocol "HTTP") ($.Values.global.certManagerEnabled) }}
19+
- name: {{ printf "%s-%v-%d" "https" $app.port $index | lower }}
1620
port: 443
21+
{{- if $app.hostname }}
22+
hostname: {{ tpl $app.hostname $ }}
23+
{{- end }}
1724
protocol: HTTPS
1825
tls:
1926
certificateRefs:
@@ -25,4 +32,4 @@ spec:
2532
namespaces:
2633
from: All
2734
{{- end }}
28-
{{- with .Values.customListeners }}{{- toYaml . | nindent 2 }}{{- end }}
35+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{ range $index, $app := .Values.apps }}
2+
---
3+
apiVersion: gateway.networking.k8s.io/{{ if (eq $app.protocol "HTTP") }}v1beta1{{ else }}v1alpha2{{ end }}
4+
kind: {{ $app.protocol }}Route
5+
metadata:
6+
name: {{ $app.name }}
7+
labels:
8+
app: {{ $app.name }}
9+
chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
10+
release: "{{ $.Release.Name }}"
11+
heritage: "{{ $.Release.Service }}"
12+
spec:
13+
{{- if $app.hostname }}
14+
hostnames:
15+
- {{ tpl $app.hostname $ }}
16+
{{- end }}
17+
parentRefs:
18+
- group: gateway.networking.k8s.io
19+
kind: Gateway
20+
name: drycc-gateway
21+
sectionName: {{ printf "%s-%v-%d" $app.protocol $app.port $index | lower }}
22+
{{- if and (eq $app.protocol "HTTP") ($.Values.global.certManagerEnabled) }}
23+
- group: gateway.networking.k8s.io
24+
kind: Gateway
25+
name: drycc-gateway
26+
sectionName: {{ printf "%s-%v-%d" "https" $app.port $index | lower }}
27+
{{- end }}
28+
rules:
29+
{{- range $service := $app.services }}
30+
- backendRefs:
31+
- name: {{ $service.name }}
32+
port: {{ $service.port }}
33+
{{- end }}
34+
{{- end }}

charts/gateway/values.yaml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,49 @@ acme:
55
externalAccountBinding:
66
keyID: ""
77
keySecret: ""
8-
# This will be the hostname prefix that is used to build endpoints
9-
domainPrefixs:
10-
- drycc
11-
- drycc-rabbitmq
12-
- drycc-passport
13-
- drycc-influxdb
14-
- drycc-prometheus
15-
- drycc-monitor-grafana
16-
17-
# custom listeners
18-
customListeners: []
8+
# gateway apps
9+
apps:
10+
- name: drycc-builder
11+
port: 2222
12+
protocol: TCP
13+
services:
14+
- name: drycc-builder
15+
port: 2222
16+
- name: drycc-controller
17+
port: 80
18+
hostname: drycc.{{ .Values.global.platformDomain }}
19+
protocol: HTTP
20+
services:
21+
- name: drycc-controller-api
22+
port: 80
23+
- name: drycc-rabbitmq
24+
port: 80
25+
hostname: drycc-rabbitmq.{{ .Values.global.platformDomain }}
26+
protocol: HTTP
27+
services:
28+
- name: drycc-rabbitmq
29+
port: 15672
30+
- name: drycc-passport
31+
port: 80
32+
hostname: drycc-passport.{{ .Values.global.platformDomain }}
33+
protocol: HTTP
34+
services:
35+
- name: drycc-passport
36+
port: 80
37+
- name: drycc-prometheus
38+
port: 80
39+
hostname: drycc-prometheus.{{ .Values.global.platformDomain }}
40+
protocol: HTTP
41+
services:
42+
- name: drycc-prometheus
43+
port: 9090
44+
- name: drycc-monitor-grafana
45+
port: 80
46+
hostname: drycc-monitor-grafana.{{ .Values.global.platformDomain }}
47+
protocol: HTTP
48+
services:
49+
- name: drycc-monitor-grafana
50+
port: 80
1951

2052
global:
2153
# Admin email, used for each component to send email to administrator
@@ -26,4 +58,4 @@ global:
2658
# This will be the hostname that is used to build endpoints such as "drycc.$HOSTNAME"
2759
platformDomain: ""
2860
# Whether certManagerEnabled is true to automatically generate drycc certificates
29-
certManagerEnabled: true
61+
certManagerEnabled: false

0 commit comments

Comments
 (0)