Skip to content

Commit bd344fd

Browse files
committed
fix: reset the ticker when the KubeSpan is disabled/enabled
Fixes #13226 The issue was that that the ticker was stopped, but never set to `nil`, so that it was never re-created when the KubeSpan is enabled back again. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 462015b commit bd344fd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • internal/app/machined/pkg/controllers/kubespan

internal/app/machined/pkg/controllers/kubespan/manager.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ func (ctrl *ManagerController) Run(ctx context.Context, r controller.Runtime, lo
119119
ticker *time.Ticker
120120
)
121121

122+
defer func() {
123+
if ticker != nil {
124+
ticker.Stop()
125+
}
126+
}()
127+
122128
if ctrl.WireguardClientFactory == nil {
123129
ctrl.WireguardClientFactory = func() (WireguardClient, error) {
124130
return wgctrl.New()
@@ -156,6 +162,7 @@ func (ctrl *ManagerController) Run(ctx context.Context, r controller.Runtime, lo
156162
if cfg == nil || !cfg.TypedSpec().Enabled {
157163
if ticker != nil {
158164
ticker.Stop()
165+
ticker = nil
159166

160167
tickerC = nil
161168
}

0 commit comments

Comments
 (0)