mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-08-05 05:19:42 +00:00
Fix race condition in tunnel server startup
Several places in the code used a 5-second retry loop to wait on Runtime.Core to be set. This caused a race condition where OnChange handlers could be added after the Wrangler shared informers were already started. When this happened, the handlers were never called because the shared informers they relied upon were not started. Fix that by requiring anything that waits on Runtime.Core to run from a cluster controller startup hook that is guaranteed to be called before the shared informers are started, instead of just firing it off in a goroutine that retries until it is set. Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
committed by
Brad Davidson
parent
1ca035accc
commit
c44d33d29b
@@ -168,8 +168,11 @@ func apiserverControllers(ctx context.Context, sc *Context, config *Config) {
|
||||
panic(errors.Wrapf(err, "failed to start %s leader controller", util.GetFunctionName(controller)))
|
||||
}
|
||||
}
|
||||
|
||||
// Re-run context startup after core and leader-elected controllers have started. Additional
|
||||
// informer caches may need to start for the newly added OnChange callbacks.
|
||||
if err := sc.Start(ctx); err != nil {
|
||||
panic(err)
|
||||
panic(errors.Wrap(err, "failed to start wranger controllers"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user