contour icon indicating copy to clipboard operation
contour copied to clipboard

Use polling during startup to wait for informers to sync

Open tsaarni opened this issue 1 year ago • 5 comments

This change will use polling for HasSynced() call to align with how client-go's WaitForCacheSync() operates. Previously it was only called when we received objects from the informer. By changing to polling, we prevent a race condition where Contour fails to recognize that the final object in the initial list has been received, which would prevent the xDS server from ever starting.

Fixes #6613

Details

The startup of a follower instance depends on informers signaling that they have finished synchronizing resources with the API server. We use the SingleFileTracker from client-go to track the processing of initial objects. This tracker increments when processing starts on a resource and decrements when its finished.

The HasSynced() method should ideally report synchronization status true right after Finished() is called for the last resource in the initial list (tracker reaches zero). However, in some cases it fails to report true immediately, causig the boolean trigger that starts the xDS server to never be set.

In case of a leader instance, an extra update triggered by the leader selection itself has ensured that the xDS server starts.

tsaarni avatar Aug 16 '24 16:08 tsaarni