This project provides a GraphQL gateway that sits in front of Milo APIServer REST/OpenAPI services and exposes a unified GraphQL API. It uses Hive Gateway with dynamic supergraph composition from OpenAPI specs at runtime.
Status: This gateway is in an initial, non‑production stage. It is intended only for local testing by the Datum team and is not production ready.
- Dynamic Supergraph Composition: The gateway dynamically fetches OpenAPI specs from the Milo APIServer and composes a unified GraphQL supergraph at runtime.
- mTLS Authentication: Uses client certificates (mTLS) to authenticate with the Kubernetes API server.
- Polling: The supergraph is recomposed periodically based on the
POLLING_INTERVALenvironment variable.
- Hive Gateway: a production-ready GraphQL gateway/router from the GraphQL Hive ecosystem.
- It:
- Dynamically composes a supergraph from OpenAPI specs fetched from Milo APIServer.
- Executes incoming GraphQL operations by delegating to the underlying Milo APIs.
- Handles concerns like header propagation, TLS, caching, and observability.
| Variable | Description | Default |
|---|---|---|
PORT |
Port the gateway listens on | 4000 |
KUBECONFIG |
Path to kubeconfig file for K8s authentication | Required |
POLLING_INTERVAL |
Interval (ms) between supergraph recomposition | 120000 (2 min) |
LOGGING |
Log level (debug, info, warn, error) |
info |
NODE_EXTRA_CA_CERTS |
Path to CA certificate for trusting K8s API server | Required for mTLS |
Defined in package.json:
-
npm run build- Compiles TypeScript source code to JavaScript.
-
npm run dev- Runs the gateway in development mode with hot reloading.
-
npm run start- Runs the compiled gateway from
dist/.
- Runs the compiled gateway from
-
npm run lint- Runs ESLint on the codebase.
A comprehensive local testing script is provided at scripts/local-test.sh. This script:
- Verifies the correct kubectl context is active
- Generates client certificates using cert-manager
- Creates a local kubeconfig with mTLS credentials
- Sets up port-forwarding to the Milo APIServer
- Runs the gateway locally
Prerequisites:
kubectlconfigured with access to the staging clustercert-managerinstalled in the cluster- Entry in
/etc/hosts:127.0.0.1 milo-apiserver
Usage:
./scripts/local-test.shThe gateway is deployed to Kubernetes using the manifests in config/base/. Key components:
- deployment.yaml: Gateway deployment with mTLS volume mounts
- service.yaml: ClusterIP service exposing port 4000
- http-route.yaml: HTTPRoute for ingress configuration
- milo-control-plane-kubeconfig.yaml: ConfigMap with kubeconfig template
-
Using the built‑in GraphQL UI:
- When running the gateway, it exposes a GraphQL endpoint at
http://127.0.0.1:4000/graphql. - Open this URL in your browser to use the UI for exploring the schema and running queries against Milo.
- When running the gateway, it exposes a GraphQL endpoint at
-
Health Endpoints:
/healthcheck- Liveness probe/readiness- Readiness probe (checks if K8s auth is initialized)