diff --git a/charts/fullstack-deployment/templates/gateway-api/gateway.yaml b/charts/fullstack-deployment/templates/gateway-api/gateway.yaml index 4bea8d1c5..2fdff18e8 100644 --- a/charts/fullstack-deployment/templates/gateway-api/gateway.yaml +++ b/charts/fullstack-deployment/templates/gateway-api/gateway.yaml @@ -47,7 +47,12 @@ spec: protocol: HTTP port: {{ $grpc_web_port }} {{- end }} - {{- end }} + {{- end }} + {{- if $.Values.gatewayApi.gateway.listeners.hederaExplorer.enable | eq "true" }} + - name: hedera-explorer # for exposing fst-hedera-explorer port 80 + protocol: HTTP + port: {{ $.Values.gatewayApi.gateway.listeners.hederaExplorer.port }} + {{- end }} # Debug ports {{- if $.Values.gatewayApi.gateway.listeners.httpDebug.enable | eq "true" }} - name: http-debug # this helps debugging gateway if needed diff --git a/charts/fullstack-deployment/templates/gateway-api/hedera-explorer-route.yaml b/charts/fullstack-deployment/templates/gateway-api/hedera-explorer-route.yaml new file mode 100644 index 000000000..1518d331a --- /dev/null +++ b/charts/fullstack-deployment/templates/gateway-api/hedera-explorer-route.yaml @@ -0,0 +1,15 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: hedera-explorer-route + namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }} + labels: + fullstack.hedera.com/type: http-route +spec: + parentRefs: + - name: fst + sectionName: hedera-explorer + rules: + - backendRefs: + - name: fst-hedera-explorer + port: 80 diff --git a/charts/fullstack-deployment/values.yaml b/charts/fullstack-deployment/values.yaml index 35c46558f..e4a77acaf 100644 --- a/charts/fullstack-deployment/values.yaml +++ b/charts/fullstack-deployment/values.yaml @@ -61,6 +61,9 @@ gatewayApi: tcpDebug: # this helps debugging gateway if needed by provisioning a mock grpc app port: 3101 enable: "true" + hederaExplorer: + port: 8888 # points to 80 port on fst-hedera-explorer + enable: "true" route: hostname: "{{ .node.name }}.fst.local" diff --git a/dev/gateway-api/Makefile b/dev/gateway-api/Makefile index b2d82c5dd..1cc3b403c 100644 --- a/dev/gateway-api/Makefile +++ b/dev/gateway-api/Makefile @@ -44,3 +44,7 @@ test-gateway-grpc-route: .PHONY: test-gateway-tcp-route test-gateway-tcp-route: source "${SCRIPTS_DIR}/${GATEWAY_API_SCRIPT}" && test_tcp_route + +.PHONY: test-gateway-hedera-explorer-route +test-gateway-hedera-explorer-route: + source "${SCRIPTS_DIR}/${GATEWAY_API_SCRIPT}" && test_hedera_explorer_route diff --git a/dev/scripts/gateway.sh b/dev/scripts/gateway.sh index 0817a2c10..d6a48b70b 100644 --- a/dev/scripts/gateway.sh +++ b/dev/scripts/gateway.sh @@ -287,3 +287,37 @@ function test_tcp_route() { log_time "test_tcp_route" } + +function test_hedera_explorer_route() { + local local_port=8888 + local gateway_port=8888 # needs to match the port specified at: $.Values.gatewayApi.gateway.listeners.hederaExplorer + expose_envoy_gateway_svc ${local_port} ${gateway_port} || return 1 + + local route_host="fst.local" + + sleep 1 + + echo "Checking ${route_host}" + echo "-----------------------------------------------------------------------------------------------------" + echo "" + + local status=$(curl --header "Host: ${route_host}" -o /dev/null -s -w "%{http_code}\n" localhost:${local_port}) + + echo "" + echo "********************************************************" + if [[ $status -eq 200 ]]; then + echo "SUCCESS: HederaExplorerRoute ${route_host}:${gateway_port}" + else + curl --header "Host: ${route_host}" -vvv localhost:${local_port} + echo "" + echo "FAIL: HederaExplorerRoute ${route_host}:${gateway_port}" + fi + echo "********************************************************" + echo "" + + echo "Cleanup" + echo "-----------------------------------------------------------------------------------------------------" + unexpose_envoy_gateway_svc || true + + log_time "test_hedera_explorer_route" +}