From 809a6eba80c94e7593b5f7d1604f1f4ac8a6b61c Mon Sep 17 00:00:00 2001 From: Irbe Krumina Date: Mon, 4 Nov 2024 18:42:51 +0000 Subject: [PATCH] cmd/k8s-operator: allow to optionally configure tailscaled port (#14005) Updates tailscale/tailscale#13981 Signed-off-by: Irbe Krumina --- cmd/k8s-operator/operator.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/k8s-operator/operator.go b/cmd/k8s-operator/operator.go index d8dd403cc..116ba02e0 100644 --- a/cmd/k8s-operator/operator.go +++ b/cmd/k8s-operator/operator.go @@ -11,6 +11,7 @@ import ( "context" "os" "regexp" + "strconv" "strings" "time" @@ -150,6 +151,13 @@ func initTSNet(zlog *zap.SugaredLogger) (*tsnet.Server, *tailscale.Client) { Hostname: hostname, Logf: zlog.Named("tailscaled").Debugf, } + if p := os.Getenv("TS_PORT"); p != "" { + port, err := strconv.ParseUint(p, 10, 16) + if err != nil { + startlog.Fatalf("TS_PORT %q cannot be parsed as uint16: %v", p, err) + } + s.Port = uint16(port) + } if kubeSecret != "" { st, err := kubestore.New(logger.Discard, kubeSecret) if err != nil {