Skip to content

Commit c41f21c

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 8809eb6 commit c41f21c

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
@@ -29,7 +29,7 @@ fn main() -> Result<()> {
2929
eprintln!(
3030
" test-exec <workdir> <command> - Test executing a command in a fork"
3131
);
32-
eprintln!(" serve <workdir> [port] [--bind addr] - Start API server (default bind: 0.0.0.0)");
32+
eprintln!(" serve <workdir> [port] - Start API server");
3333
Ok(())
3434
}
3535
}
@@ -390,26 +390,10 @@ fn load_api_keys() -> Vec<String> {
390390

391391
fn cmd_serve(args: &[String]) -> Result<()> {
392392
if args.len() < 1 {
393-
bail!("Usage: zeroboot serve <workdir>[,lang:workdir2,...] [port] [--bind <addr>]");
393+
bail!("Usage: zeroboot serve <workdir>[,lang:workdir2,...] [port]");
394394
}
395395
let port: u16 = args.get(1).and_then(|p| p.parse().ok()).unwrap_or(8080);
396396

397-
// Parse optional --bind flag (default 0.0.0.0 for Kubernetes compatibility).
398-
// K8s health probes and Service ClusterIP routing require the server to listen
399-
// on all interfaces, not just localhost.
400-
let bind_addr = {
401-
let mut addr = "0.0.0.0".to_string();
402-
let mut i = 2;
403-
while i + 1 < args.len() {
404-
if args[i] == "--bind" {
405-
addr = args[i + 1].clone();
406-
break;
407-
}
408-
i += 1;
409-
}
410-
addr
411-
};
412-
413397
// Parse workdir specs: "workdir" or "python:workdir1,node:workdir2"
414398
let mut templates = std::collections::HashMap::new();
415399
for spec in args[0].split(',') {
@@ -446,10 +430,10 @@ fn cmd_serve(args: &[String]) -> Result<()> {
446430
.route("/v1/metrics", axum::routing::get(metrics_handler))
447431
.with_state(state);
448432

449-
let listener = tokio::net::TcpListener::bind(format!("{}:{}", bind_addr, port))
433+
let listener = tokio::net::TcpListener::bind(format!("127.0.0.1:{}", port))
450434
.await
451435
.unwrap();
452-
eprintln!("Zeroboot API server listening on {}:{}", bind_addr, port);
436+
eprintln!("Zeroboot API server listening on port {}", port);
453437
axum::serve(
454438
listener,
455439
app.into_make_service_with_connect_info::<std::net::SocketAddr>(),

0 commit comments

Comments
 (0)