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>
This commit is contained in:
Andrey Smirnov 2026-04-28 19:18:16 +04:00
parent 462015bcd9
commit bd344fd53f
No known key found for this signature in database
GPG Key ID: 322C6F63F594CE7C

View File

@ -119,6 +119,12 @@ func (ctrl *ManagerController) Run(ctx context.Context, r controller.Runtime, lo
ticker *time.Ticker
)
defer func() {
if ticker != nil {
ticker.Stop()
}
}()
if ctrl.WireguardClientFactory == nil {
ctrl.WireguardClientFactory = func() (WireguardClient, error) {
return wgctrl.New()
@ -156,6 +162,7 @@ func (ctrl *ManagerController) Run(ctx context.Context, r controller.Runtime, lo
if cfg == nil || !cfg.TypedSpec().Enabled {
if ticker != nil {
ticker.Stop()
ticker = nil
tickerC = nil
}