summaryrefslogtreecommitdiffhomepage
path: root/cmd/containerboot/tailscaled.go
diff options
context:
space:
mode:
authorLee Briggs <lee@leebriggs.co.uk>2024-12-13 11:54:35 +0000
committerLee Briggs <lee@leebriggs.co.uk>2024-12-13 11:57:24 +0000
commitd998cf08372b75e13a7d5f9d65fc9ee5323f616c (patch)
treed46819b152a501c3d6c2d6f60036b54e5bfe9d3b /cmd/containerboot/tailscaled.go
parent73128e25230fda8c82696ed0ffef991bce68cecc (diff)
downloadtailscale-docker_state.tar.xz
tailscale-docker_state.zip
cmd/containerboot: introduce `TS_STATE` env vardocker_state
Fixes #12180 Fixed #13409 Signed-off-by: Lee Briggs <lee@leebriggs.co.uk>
Diffstat (limited to 'cmd/containerboot/tailscaled.go')
-rw-r--r--cmd/containerboot/tailscaled.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/cmd/containerboot/tailscaled.go b/cmd/containerboot/tailscaled.go
index d8da49b03..46dcb4a5b 100644
--- a/cmd/containerboot/tailscaled.go
+++ b/cmd/containerboot/tailscaled.go
@@ -62,17 +62,22 @@ func startTailscaled(ctx context.Context, cfg *settings) (*tailscale.LocalClient
// tailscaledArgs uses cfg to construct the argv for tailscaled.
func tailscaledArgs(cfg *settings) []string {
args := []string{"--socket=" + cfg.Socket}
- switch {
- case cfg.InKubernetes && cfg.KubeSecret != "":
- args = append(args, "--state=kube:"+cfg.KubeSecret)
- if cfg.StateDir == "" {
- cfg.StateDir = "/tmp"
+ if cfg.State != "" {
+ args = append(args, "--state="+cfg.State)
+ } else {
+ // Fallback logic for legacy state configuration
+ switch {
+ case cfg.InKubernetes && cfg.KubeSecret != "":
+ args = append(args, "--state=kube:"+cfg.KubeSecret)
+ if cfg.StateDir == "" {
+ cfg.StateDir = "/tmp"
+ }
+ fallthrough
+ case cfg.StateDir != "":
+ args = append(args, "--statedir="+cfg.StateDir)
+ default:
+ args = append(args, "--state=mem:", "--statedir=/tmp")
}
- fallthrough
- case cfg.StateDir != "":
- args = append(args, "--statedir="+cfg.StateDir)
- default:
- args = append(args, "--state=mem:", "--statedir=/tmp")
}
if cfg.UserspaceMode {