Skip to content

Commit

Permalink
feat: support higher number of nodes with consistent gateway port map…
Browse files Browse the repository at this point in the history
…ping (#337)

Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
  • Loading branch information
leninmehedy authored Sep 13, 2023
1 parent 5052945 commit 8b44410
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: envoy-routes-{{ $node.name }}
name: envoy-grpc-web-route-{{ $node.name }}
namespace: default
labels:
fullstack.hedera.com/type: http-route
spec:
parentRefs:
- name: fst
sectionName: http-{{ $node.name }}
sectionName: grpc-web-{{ $node.name }}
hostnames:
- {{ tpl $.Values.gatewayApi.route.hostname (dict "node" $node "Template" $.Template) }}
rules:
Expand Down
28 changes: 21 additions & 7 deletions charts/hedera-network/templates/gateway-api/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,31 @@ spec:
allowedRoutes:
kinds:
- kind: TCPRoute # we use TCPRoute to for GRPC
{{- range $index, $node := $.Values.hedera.nodes }}
{{- $tcp_port := mul $index 1000 | add 50211 }}
{{- $http_port := mul $index 100 | add 8080 }}
- name: tcp-{{ $node.name }} # for haproxy or network-node TCPRoute
{{- range $index, $node := $.Values.hedera.nodes }} # we assume to have at most 999 nodes in a single cluster
{{- $gossip_port := add $index 51000 }} # node0:51000 ... node999: 51999, points to 50111 port in haproxy or network-node
{{- $grpc_port := add $index 52000 }} # node0:52000 ... node999: 52999, points to 50211 port in haproxy or network-node
{{- $grpcs_port := add $index 53000 }} # node0:53000 ... node999: 53999, points to 50212 port in haproxy or network-node
{{- $grpc_web_port := add $index 18000 }} # node0:18000 ... node999: 18999, points to 8080 port in envoy proxy
- name: gossip-{{ $node.name }} # for exposing gossip port 50111 from network-node
protocol: TCP
port: {{ $tcp_port }}
port: {{ $gossip_port }}
allowedRoutes:
kinds:
- kind: TCPRoute
- name: http-{{ $node.name }} # for envoy-proxy HTTPRoute
- name: grpc-{{ $node.name }} # for exposing grpc port 50211 from haproxy or network-node
protocol: TCP
port: {{ $grpc_port }}
allowedRoutes:
kinds:
- kind: TCPRoute
- name: grpcs-{{ $node.name }} # for exposing grpc port 50212 from haproxy or network-node
protocol: TCP
port: {{ $grpcs_port }}
allowedRoutes:
kinds:
- kind: TCPRoute
- name: grpc-web-{{ $node.name }} # for exposing grpc-web port 8080 from envoy-proxy
protocol: HTTP
port: {{ $http_port }}
port: {{ $grpc_web_port }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
spec:
parentRefs:
- name: fst
sectionName: tcp-{{ $node.name }}
sectionName: grpc-{{ $node.name }}
rules:
- backendRefs:
- name: haproxy-{{ $node.name }}-svc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
spec:
parentRefs:
- name: fst
sectionName: tcp-{{ $node.name }}
sectionName: grpc-{{ $node.name }}
rules:
- backendRefs:
- name: network-{{ $node.name }}-svc
Expand Down

0 comments on commit 8b44410

Please sign in to comment.