summaryrefslogtreecommitdiffhomepage
path: root/cmd/containerboot/tailscaled.go
diff options
context:
space:
mode:
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 {