Please note: this version has a static control-plane where service status is managed manually. The kubernetes version has automatic detection of scaled-to-zero services.
In Envoy the high-level architecture looks like this:
For more info about the demo see the scripts in demo
brew tap tinygo-org/tools
brew install tinygo
- 7001: control plane
- 8001: Envoy admin endpoint
- 9000: Envoy traffic endpoint (hosts:
http.example.com
,grpc.example.com
) - 50001: upstream backend (http)
- 50002: upstream backend (grpc)
make build-wasm && docker-compose -f local-envoy/docker-compose.yaml up
The control-plane returns a list of which services are "scaled-to-zero" (dummy):
# Get current list
curl localhost:7001/
[]
# Setting a service to "scaled to zero" or unset "scaled to zero"
curl -X POST "localhost:7001/set-scaled-to-zero?host=http.example.com"
curl -X POST "localhost:7001/set-scaled-to-zero?host=grpc.example.com"
# HTTP
curl localhost:50001
Hello from HTTP Server
# GRPC
grpcurl -plaintext localhost:50002 grpc.health.v1.Health/Check
{
"status": "SERVING"
}
# HTTP
curl localhost:9000 -H 'Host: http.example.com'
Hello from HTTP Server
# GRPC
grpcurl -plaintext -authority grpc.example.com localhost:9000 grpc.health.v1.Health/Check
{
"status": "SERVING"
}