cmd/k8s-operator: fix regression from earlier refactor

I forgot to move the defer out of the func, so the tsnet.Server
immediately closed after starting.

Updates #502

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/9066/head
Maisem Ali 1 year ago committed by Maisem Ali
parent 9089efea06
commit 74388a771f

@ -65,6 +65,7 @@ func main() {
logf.SetLogger(zapr.NewLogger(zlog.Desugar())) logf.SetLogger(zapr.NewLogger(zlog.Desugar()))
s, tsClient := initTSNet(zlog) s, tsClient := initTSNet(zlog)
defer s.Close()
restConfig := config.GetConfigOrDie() restConfig := config.GetConfigOrDie()
if shouldRunAuthProxy { if shouldRunAuthProxy {
launchAuthProxy(zlog, restConfig, s) launchAuthProxy(zlog, restConfig, s)
@ -118,7 +119,6 @@ func initTSNet(zlog *zap.SugaredLogger) (*tsnet.Server, *tailscale.Client) {
if err := s.Start(); err != nil { if err := s.Start(); err != nil {
startlog.Fatalf("starting tailscale server: %v", err) startlog.Fatalf("starting tailscale server: %v", err)
} }
defer s.Close()
lc, err := s.LocalClient() lc, err := s.LocalClient()
if err != nil { if err != nil {
startlog.Fatalf("getting local client: %v", err) startlog.Fatalf("getting local client: %v", err)

Loading…
Cancel
Save