This directory documents the developer cluster testing workflow for XManager on Cloud (XMC v2) metrics telemetry pipelines.
Note
In XMC v2, Redpanda and ClickHouse are Bring-Your-Own (BYO) infrastructure components managed out-of-band by enterprise platform administrators. They are not bundled as local Docker containers in the delivered XMC product stack.
For developer testing, BYO Redpanda (xmc namespace) and ClickHouse (xmc-metrics namespace) instances are deployed onto a GKE developer test cluster via deploy/addons/metrics/setup_metrics_addons.sh, and redpanda, clickhouse, and ingestion-gateway are enabled via the stable-2026a Component profile (xmc-profile).
flowchart TD
subgraph "Local Workstation / Developer Machine"
DIAG["xmc-diag CLI"]
CURL["curl / Python Client"]
end
subgraph "GKE Developer Cluster (Namespaces: xmc & xmc-metrics)"
GW["svc/ingestion-gateway-service (8080, xmc)"]
RP["svc/redpanda (9092, xmc)"]
CH["svc/clickhouse (9000 / 8123, xmc-metrics)"]
end
CURL -->|kubectl port-forward 8080:8080| GW
DIAG -->|kubectl port-forward 9000:9000| CH
DIAG -->|kubectl port-forward 9092:9092| RP
GW -->|Protobuf Metrics| RP
RP -->|Kafka Consumer Group xmc-clickhouse-ingester| CH
Deploy the backing metrics addons, enable redpanda, clickhouse, and ingestion-gateway in xmc-profile, and open port-forwards for local testing:
# 1. Authenticate to GKE cluster
gcloud container clusters get-credentials <CLUSTER_NAME> \
--region <REGION> \
--project <PROJECT_ID>
# 2. Deploy lightweight Redpanda (xmc) and ClickHouse (xmc-metrics) addons + schema
./deploy/addons/metrics/setup_metrics_addons.sh
# 3. Enable redpanda, clickhouse, and ingestion-gateway in xmc-profile (actuated by xmc-bridge)
helm upgrade --install --reset-then-reuse-values xmc-profile ./deploy/profiles/stable-2026a -n xmc \
--set components.redpanda.enabled=true \
--set components.clickhouse.enabled=true \
--set components.ingestion-gateway.enabled=true \
--wait
# 3b. Wait for xmc-bridge to actuate the ingestion-gateway component release
kubectl wait --for=condition=Ready components.xmc.dev/ingestion-gateway -n xmc --timeout=5m
kubectl rollout status deployment/ingestion-gateway-deployment -n xmc --timeout=180s
# 4. Port-forward ClickHouse native TCP port (9000 in xmc-metrics)
kubectl port-forward svc/clickhouse 9000:9000 -n xmc-metrics &
# 5. Port-forward Redpanda service (9092 in xmc)
kubectl port-forward svc/redpanda 9092:9092 -n xmc &
# 6. Port-forward Ingestion Gateway HTTP service (8080 in xmc)
kubectl port-forward svc/ingestion-gateway-service 8080:8080 -n xmc &Run xmc-diag from your local machine to verify ClickHouse schema initialization (xmc_metrics, xmc_metrics_queue, xmc_metrics_mv) and Redpanda consumer lag:
go run ./tools/xmc-diag \
--clickhouse_host=127.0.0.1 \
--clickhouse_port=9000 \
--redpanda_brokers=127.0.0.1:9092 \
--dial_with_seed_only=true \
--consumer_group=xmc-clickhouse-ingesterExpected Output:
=== XMC Infrastructure Diagnostics (Status: HEALTHY) ===
Timestamp: ...
[ClickHouse Diagnostics] Status: HEALTHY
Connected: true
Version: 24.3...
Schema Tables: All required tables present (xmc_metrics, xmc_metrics_queue, xmc_metrics_mv)
Query Smoke Latency: 140ms
[Redpanda/Kafka Diagnostics] Status: HEALTHY
Connected: true
Broker Count: 1
Topic Partitions (xmc-metrics): 128
Consumer Group (xmc-clickhouse-ingester) Aggregate Lag: 0 records
Ping Smoke Latency: 540ms
[Kubernetes Components Diagnostics] Status: HEALTHY
Healthy: true
Namespace: xmc
Component clickhouse: enabled=true state=STATE_READY ready=true healthy=true stability=STABLE
Component ingestion-gateway: enabled=true state=STATE_READY ready=true healthy=true stability=STABLE
Component redpanda: enabled=true state=STATE_READY ready=true healthy=true stability=STABLE
Send sample JSON metric records to the port-forwarded Ingestion Gateway:
curl -X POST http://localhost:8080/api/v1/metrics \
-H "Content-Type: application/json" \
-d '[
{
"xid": 1001,
"work_unit_id": 1,
"execution_id": 1,
"replica_id": "worker-0",
"metric_name": "train_loss",
"metric_value": 0.85,
"step": 10,
"timestamp": 1770000000000000
},
{
"xid": 1001,
"work_unit_id": 1,
"execution_id": 1,
"replica_id": "worker-0",
"metric_name": "train_loss",
"metric_value": 0.72,
"step": 20,
"timestamp": 1770000010000000
},
{
"xid": 1001,
"work_unit_id": 1,
"execution_id": 1,
"replica_id": "worker-0",
"metric_name": "train_loss",
"metric_value": 0.65,
"step": 20,
"timestamp": 1770000020000000
}
]'Expected Response:
{"count":3,"status":"accepted"}ClickHouse reads Protobuf records asynchronously from Redpanda topic xmc-metrics via xmc_metrics_queue and materializes them into xmc_metrics.
Execute verification queries directly against ClickHouse via kubectl exec:
kubectl exec -it statefulset/clickhouse -n xmc-metrics -- clickhouse-client --query \
"SELECT xid, work_unit_id, metric_name, metric_value, step, timestamp, created_at FROM xmc_metrics ORDER BY timestamp ASC;"Selects the value with the latest client event timestamp per step (matching internal/dashboard/dataengine/summary_box.go), breaking identical-timestamp ties by created_at:
kubectl exec -it statefulset/clickhouse -n xmc-metrics -- clickhouse-client --query \
"SELECT xid, work_unit_id, metric_name, step, argMax(metric_value, (timestamp, created_at)) AS latest_value FROM xmc_metrics GROUP BY xid, work_unit_id, metric_name, step ORDER BY step ASC;"For detailed CLI options, configuration resolution precedence, dynamic service discovery, and architecture specifications, refer to the Development Environment Tooling Guide.
# 1. Start full local environment (Spanner databases, KinD cluster, images, and Helm release)
python3 tools/dev_env/dev_env.py up
# 2. Hot-reload changed microservices on demand
python3 tools/dev_env/dev_env.py reload
# 3. Or enable continuous live watch mode (auto-rebuilds and restarts on file save)
python3 tools/dev_env/dev_env.py reload --watch
# 4. Check cluster health and service pod readiness
python3 tools/dev_env/dev_env.py status
# 5. Stream container logs from a specific service
python3 tools/dev_env/dev_env.py logs reconciler -f
# 6. Tear down local environment when finished
python3 tools/dev_env/dev_env.py downTip
Configuration parameters (such as project ID, Spanner instance, and microservices) can be configured via deploy/local/xmanager-cloud-local.yaml, environment variables, or CLI flags. See the Configuration Architecture Guide for the full configuration reference and resolution precedence rules.
Foundational XMC Components (components.xmc.dev CRD and xmc-bridge-deployment) are included by default in dev_env.py up and reload, and deploy_dev_env.py / upgrade_dev_env.py automatically deploy xmc-bridge and the stable-2026a profile (xmc-profile) on GKE:
# Local KinD environment (includes components.xmc.dev CRD + xmc-bridge-deployment by default)
python3 tools/dev_env/dev_env.py up
# Optional: install the stable-2026a Component CR profile into local KinD
helm upgrade --install --reset-then-reuse-values xmc-profile ./deploy/profiles/stable-2026a -n xmc --wait
# Hot-reload xmc_bridge after modifying cmd/xmc_bridge/ or pkg/components/
python3 tools/dev_env/dev_env.py reload xmc_bridge
# GKE Developer Environment deploy or upgrade (CRD + xmc-bridge + stable-2026a profile)
python3 tools/dev_env/deploy_dev_env.py --config deploy/ctk_v2/xmanager-cloud-deployment.yaml \
--dns-project <DNS_PROJECT> --dns-zone <DNS_ZONE>
python3 tools/dev_env/upgrade_dev_env.py --config deploy/ctk_v2/xmanager-cloud-deployment.yamlTo run cmd/xmc_bridge directly on your workstation against a cluster:
# 1. Port-forward the in-cluster gRPC service (or run ComponentManagementService locally)
kubectl port-forward svc/grpc-service -n xmc 50051:50051 &
# 2. Run xmc_bridge locally using your active kubeconfig
bazel run //cmd/xmc_bridge -- \
--cms-address=localhost:50051 \
--namespace=xmc \
--release-name=xmcThe current local development workflow uses Direct Container Streaming & Fast Probes:
- Delta-Scoped Change Detection: Only the exact files modified in a given save are evaluated by
ChangeDetector, ignoring unrelated dirty files. - Direct KinD
containerdStreaming: Bazel-built OCI tarballs are piped directly into the KinD node'scontainerdviactr --namespace=k8s.io images import -, bypassing the intermediate hostdocker loadandkind loaddouble-tar roundtrip (~15s saved). - Aggressive Dev Probes & Instant Pod Swaps: Local deployments are patched with
initialDelaySeconds: 1,periodSeconds: 1, andterminationGracePeriodSeconds: 0, eliminating rollout stalls. - Persistent BuildKit Cache Mounts: Angular builds in
cmd/ui/build_ui_oci.pyutilize BuildKit--mount=type=cache,target=/app/.angular/cacheand development configuration.
| Component | Reload Latency | Dominant Phase |
|---|---|---|
| Go Backends (ESS, XID, Reconciler) | ~15–19s | Bazel transitive graph analysis across 14,000+ proto/Go targets (~13s) + Pod rollout (~4s) |
| Angular UI | ~35–42s | Docker BuildKit container spawn + Angular build + tarball export (~35s) + Pod rollout (~3s) |
For sub-5-second local iteration loops, a Level 2 In-Pod Sync pattern can be implemented in the future (e.g. via dev_env.py reload --fast or -f):
- Go Backends: Compile the bare Linux ELF binary via Bazel (
//cmd/<service>) in ~1.5s, sync/bin/<service>directly into the active pod viakubectl cporhostPath, and trigger an in-pod process restart (~50ms). - Angular UI: Execute
ng build --configuration developmenton host in ~3s, and syncdist/browserdirectly into Nginx's/usr/share/nginx/htmlwithout restarting the pod.
When implementing Level 2 in-pod syncing, be aware of the following architectural trade-offs:
- Pod Ephemerality Drift ("Disappearing Fixes"):
- In Level 2, code is synced into the active pod's writable layer, not the immutable container image.
- If a pod crashes, runs out of memory (OOM), or gets rescheduled by Kubernetes, it will restart from the older base image stored in
containerd, temporarily reverting uncommitted hot-fixes until the next sync or full build.
- Dockerfile & Container Configuration Blindspots:
- Level 2 only syncs compiled application artifacts (
*.go,*.ts,*.html,*.scss). - Edits to
Dockerfile,nginx.conf, entrypoint shell scripts, or new system package dependencies (apk add) are completely bypassed during in-pod sync and require a full Level 1 container rebuild to take effect.
- Level 2 only syncs compiled application artifacts (
- Host Toolchain vs. Container Toolchain Drift:
- Host
ng buildruns using the host machine's Node.js and npm versions rather than the hermetic, container-pinnednode:22-alpineenvironment. - Non-hermetic Go builds could potentially pick up host glibc libraries if CGO is enabled, rather than static Alpine
muslbinaries.
- Host
- Container Security Context Drift:
- Production GKE deployments enforce
readOnlyRootFilesystem: trueand non-root users (runAsUser: 1000). - In-pod hot-syncing requires target paths (
/bin/or/usr/share/nginx/html) to be writable, requiring relaxed filesystem security or dedicatedemptyDir/hostPathvolume mounts in local dev manifests.
- Production GKE deployments enforce
- Process Lifecycle & PID 1 Behavior:
- In production, microservice binaries execute as PID 1. If the binary exits, the container terminates.
- In-pod hot-restarting requires a lightweight supervisor or wrapper script inside the dev container to restart the process in-place without triggering Kubernetes
CrashLoopBackOff.
To safely leverage Level 2 velocity without risking production drift:
- Provide Level 2 as an opt-in fast flag (e.g.
dev_env local reload -w --fast). - Automatically fall back to a full Level 1 container rebuild whenever
package.json,go.mod,Dockerfile, ordeploy/templates are modified. - Run a full hermetic verification (
dev_env build-imagesor Bazel test suite) prior to opening Pull Requests.