Call non-blocking informerFactory.Start synchronously to avoid races

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>

Kubernetes-commit: c7a1fa432a87579895eac4b3873162d5f1dba7f5
This commit is contained in:
Dr. Stefan Schimanski 2024-07-27 16:13:16 +02:00 committed by Kubernetes Publisher
parent 4536e5a391
commit f71a5cc5d3

View File

@ -120,7 +120,7 @@ func NewCandidate(clientset kubernetes.Interface,
func (c *LeaseCandidate) Run(ctx context.Context) { func (c *LeaseCandidate) Run(ctx context.Context) {
defer c.queue.ShutDown() defer c.queue.ShutDown()
go c.informerFactory.Start(ctx.Done()) c.informerFactory.Start(ctx.Done())
if !cache.WaitForNamedCacheSync("leasecandidateclient", ctx.Done(), c.hasSynced) { if !cache.WaitForNamedCacheSync("leasecandidateclient", ctx.Done(), c.hasSynced) {
return return
} }