Skip to content

Commit 425a012

Browse files
committed
sophora-server: add grpc-httproute
1 parent 5b96abd commit 425a012

File tree

3 files changed

+78
-21
lines changed

3 files changed

+78
-21
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if and .Values.grpcHttproute.enabled .Values.sophora.grpcApi.enabled -}}
2+
{{- $fullName := include "sophora-server.fullname" . -}}
3+
{{- $routeName := printf "%s-grpc" ($fullName | trunc 58 | trimSuffix "-") }}
4+
apiVersion: gateway.networking.k8s.io/v1
5+
kind: HTTPRoute
6+
metadata:
7+
name: {{ $routeName }}
8+
labels: {{ include "sophora-server.topLevelLabels" . | nindent 4 }}
9+
{{- with .Values.grpcHttproute.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
{{- with .Values.grpcHttproute.parentRefs }}
15+
parentRefs:
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
{{- if .Values.grpcHttproute.hostnames }}
19+
hostnames:
20+
{{- range .Values.grpcHttproute.hostnames }}
21+
- {{ . | quote }}
22+
{{- end }}
23+
{{- end }}
24+
rules:
25+
- backendRefs:
26+
- name: {{ $fullName }}
27+
port: {{ .Values.sophora.server.ports.grpc }}
28+
matches:
29+
- path:
30+
type: {{ .Values.grpcHttproute.pathMatchType | default "PathPrefix" }}
31+
value: {{ .Values.grpcHttproute.pathValue | default "/sophora.srpc" }}
32+
{{- end }}

charts/sophora-server/test-values.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,8 @@ ingress:
127127
hosts:
128128
- host: "sophora.domain.de"
129129

130-
httproute:
131-
enabled: true
132-
parentRefs:
133-
- name: test-gateway
134-
namespace: gateway-system
135-
hostnames:
136-
- "sophora-server.test.example.com"
137-
138130
grpcIngress:
131+
enabled: true
139132
ingressClassName: nginx
140133
annotations:
141134
nginx.ingress.kubernetes.io/use-regex: "true"
@@ -144,6 +137,22 @@ grpcIngress:
144137
- host: "sophora.domain.de"
145138
path: /sophora\.srpc.*
146139

140+
httproute:
141+
enabled: true
142+
parentRefs:
143+
- name: test-gateway
144+
namespace: gateway-system
145+
hostnames:
146+
- "sophora-server.test.example.com"
147+
148+
grpcHttproute:
149+
enabled: true
150+
parentRefs:
151+
- name: test-gateway
152+
namespace: gateway-system
153+
hostnames:
154+
- "sophora-server.test.example.com"
155+
147156
extraDeploy:
148157
- |
149158
apiVersion: keda.sh/v1alpha1

charts/sophora-server/values.yaml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,6 @@ ingress:
365365
# hosts:
366366
# - chart-example.local
367367

368-
httproute:
369-
enabled: false
370-
# parentRefs:
371-
# - name: my-gateway
372-
# namespace: gateway-namespace
373-
parentRefs: []
374-
# hostnames:
375-
# - "server.example.com"
376-
hostnames: []
377-
pathMatchType: PathPrefix
378-
pathValue: /
379-
annotations: {}
380-
381368
# This can be used to configure a different ingress for the SRPC service as it might require different settings.
382369
# The SRPC-communication relies on gRPC as communication protocol and e.g. nginx needs to be explicitly informed that the backend protocol is gRPC
383370
# The paths can be regex-matched since all SRPC-calls have the root-path sophora.srpc
@@ -398,6 +385,35 @@ grpcIngress:
398385
# hosts:
399386
# - chart-example.local
400387

388+
httproute:
389+
enabled: false
390+
# parentRefs:
391+
# - name: my-gateway
392+
# namespace: gateway-namespace
393+
parentRefs: []
394+
# hostnames:
395+
# - "server.example.com"
396+
hostnames: []
397+
pathMatchType: PathPrefix
398+
pathValue: /
399+
annotations: {}
400+
401+
# This can be used to configure a different HttpRoute for the SRPC service as it might require different settings.
402+
# The SRPC-communication relies on gRPC as communication protocol and e.g. nginx needs to be explicitly informed that the backend protocol is gRPC
403+
# The paths can be regex-matched since all SRPC-calls have the root-path sophora.srpc
404+
grpcHttproute:
405+
enabled: false
406+
# parentRefs:
407+
# - name: my-gateway
408+
# namespace: gateway-namespace
409+
parentRefs: []
410+
# hostnames:
411+
# - "server.example.com"
412+
hostnames: []
413+
pathMatchType: PathPrefix
414+
pathValue: /sophora.srpc
415+
annotations: {}
416+
401417
service:
402418
annotations: {}
403419
headlessAnnotations: {}

0 commit comments

Comments
 (0)