Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Gateway API route for Hedera Explorer #466

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions charts/fullstack-deployment/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 4 additions & 0 deletions dev/gateway-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 34 additions & 0 deletions dev/scripts/gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}