From 1d33157ab979395b0278d8cd1fa77f6fa9ce22f1 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Thu, 21 Jul 2022 15:38:52 -0700 Subject: [PATCH] docs/k8s: use job control in run.sh This has the benefit of propagating SIGINT to tailscaled, which in turn can react to the event and logout in case of an ephemeral node. Also fix missing run.sh in Dockerfile. Signed-off-by: Maisem Ali --- Dockerfile | 1 + docs/k8s/run.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3aea0039..f088c7e18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,3 +72,4 @@ FROM alpine:3.16 RUN apk add --no-cache ca-certificates iptables iproute2 ip6tables COPY --from=build-env /go/bin/* /usr/local/bin/ +COPY --from=build-env /go/src/tailscale/docs/k8s/run.sh /usr/local/bin/ diff --git a/docs/k8s/run.sh b/docs/k8s/run.sh index 0a151da00..7c6294dd7 100755 --- a/docs/k8s/run.sh +++ b/docs/k8s/run.sh @@ -4,6 +4,8 @@ #! /bin/sh +set -m # enable job control + export PATH=$PATH:/tailscale/bin TS_AUTH_KEY="${TS_AUTH_KEY:-}" @@ -60,7 +62,6 @@ fi echo "Starting tailscaled" tailscaled ${TAILSCALED_ARGS} & -PID=$! UP_ARGS="--accept-dns=${TS_ACCEPT_DNS}" if [[ ! -z "${TS_ROUTES}" ]]; then @@ -81,4 +82,4 @@ if [[ ! -z "${TS_DEST_IP}" ]]; then iptables -t nat -I PREROUTING -d "$(tailscale --socket=/tmp/tailscaled.sock ip -4)" -j DNAT --to-destination "${TS_DEST_IP}" fi -wait ${PID} +fg