mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
27 lines
968 B
Bash
Executable File
27 lines
968 B
Bash
Executable File
#!/bin/sh
|
|
# CAKE entrypoint — bridge Istio abstract socket to file socket, then exec relay.
|
|
#
|
|
# Traffic flow:
|
|
# Client → Envoy → @istio-proxy.sock (abstract) → socat → /tmp/local.sock → Sprout
|
|
# K8s probes → 0.0.0.0:8080 → Sprout (direct, no Istio)
|
|
# Prometheus → 0.0.0.0:9102/metrics → Sprout
|
|
set -eu
|
|
|
|
SIDECAR_SOCKET="${SIDECAR_LISTENER_BIND:-@istio-proxy.sock}"
|
|
LOCAL_SOCKET="/tmp/local.sock"
|
|
|
|
# Clean up stale socket file from previous run.
|
|
rm -f "${LOCAL_SOCKET}"
|
|
|
|
# Bridge: Envoy writes to abstract socket → socat → app reads from file socket.
|
|
# Only start if SIDECAR_LISTENER_BIND is set (i.e., running in CAKE).
|
|
if [ -n "${SIDECAR_LISTENER_BIND:-}" ]; then
|
|
socat "ABSTRACT-LISTEN:${SIDECAR_SOCKET#@},fork" "UNIX-CONNECT:${LOCAL_SOCKET}" &
|
|
export SPROUT_UDS_PATH="${LOCAL_SOCKET}"
|
|
fi
|
|
|
|
export SPROUT_HEALTH_PORT="${SPROUT_HEALTH_PORT:-8080}"
|
|
export SPROUT_METRICS_PORT="${SPROUT_METRICS_PORT:-9102}"
|
|
|
|
exec /code/sprout-relay
|