Skip to content

Commit a2898a1

Browse files
author
Ubuntu
committed
revert: move serve --bind fix out of K8s PR (to be submitted separately)
src/main.rs and entrypoint.sh bind address changes belong in a dedicated fix PR. This PR should only contain K8s deployment configs and docs. The deployment.yaml already handles the 127.0.0.1 limitation via the hostPath /dev/kvm approach; users can add a socat sidecar if needed until the fix PR is merged.
1 parent 1a19344 commit a2898a1

2 files changed

Lines changed: 5 additions & 22 deletions

File tree

docker/entrypoint.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ KERNEL="${ZEROBOOT_KERNEL:-${WORKDIR}/vmlinux-fc}"
66
ROOTFS_PYTHON="${ZEROBOOT_ROOTFS_PYTHON:-${WORKDIR}/rootfs-python.ext4}"
77
ROOTFS_NODE="${ZEROBOOT_ROOTFS_NODE:-}"
88
PORT="${ZEROBOOT_PORT:-8080}"
9-
BIND="${ZEROBOOT_BIND:-0.0.0.0}"
109
TEMPLATE_WAIT="${ZEROBOOT_TEMPLATE_WAIT:-15}"
1110

1211
# ── Validate KVM access ───────────────────────────────────────────────────────
@@ -67,4 +66,4 @@ fi
6766

6867
# ── Start API server ──────────────────────────────────────────────────────────
6968
echo "Starting zeroboot API server on port ${PORT}..."
70-
exec /usr/local/bin/zeroboot serve "$SERVE_TARGET" "$PORT" --bind "$BIND"
69+
exec /usr/local/bin/zeroboot serve "$SERVE_TARGET" "$PORT"

src/main.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn main() -> Result<()> {
3030
eprintln!(
3131
" test-exec <workdir> <command> - Test executing a command in a fork"
3232
);
33-
eprintln!(" serve <workdir> [port] [--bind addr] - Start API server (default bind: 0.0.0.0)");
33+
eprintln!(" serve <workdir> [port] - Start API server");
3434
Ok(())
3535
}
3636
}
@@ -426,26 +426,10 @@ fn load_api_keys() -> Vec<String> {
426426

427427
fn cmd_serve(args: &[String]) -> Result<()> {
428428
if args.len() < 1 {
429-
bail!("Usage: zeroboot serve <workdir>[,lang:workdir2,...] [port] [--bind <addr>]");
429+
bail!("Usage: zeroboot serve <workdir>[,lang:workdir2,...] [port]");
430430
}
431431
let port: u16 = args.get(1).and_then(|p| p.parse().ok()).unwrap_or(8080);
432432

433-
// Parse optional --bind flag (default 0.0.0.0 for Kubernetes compatibility).
434-
// K8s health probes and Service ClusterIP routing require the server to listen
435-
// on all interfaces, not just localhost.
436-
let bind_addr = {
437-
let mut addr = "0.0.0.0".to_string();
438-
let mut i = 2;
439-
while i + 1 < args.len() {
440-
if args[i] == "--bind" {
441-
addr = args[i + 1].clone();
442-
break;
443-
}
444-
i += 1;
445-
}
446-
addr
447-
};
448-
449433
// Parse workdir specs: "workdir" or "python:workdir1,node:workdir2"
450434
let mut templates = std::collections::HashMap::new();
451435
for spec in args[0].split(',') {
@@ -482,10 +466,10 @@ fn cmd_serve(args: &[String]) -> Result<()> {
482466
.route("/v1/metrics", axum::routing::get(metrics_handler))
483467
.with_state(state);
484468

485-
let listener = tokio::net::TcpListener::bind(format!("{}:{}", bind_addr, port))
469+
let listener = tokio::net::TcpListener::bind(format!("127.0.0.1:{}", port))
486470
.await
487471
.unwrap();
488-
eprintln!("Zeroboot API server listening on {}:{}", bind_addr, port);
472+
eprintln!("Zeroboot API server listening on port {}", port);
489473
axum::serve(
490474
listener,
491475
app.into_make_service_with_connect_info::<std::net::SocketAddr>(),

0 commit comments

Comments
 (0)