Allow follower to start with empty initial resource list #6295
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change fixes a bug that caused follower instance of Contour not reach the ready state when started under following condition:
--watched-namespaces
do not contain any resources.As result, XDS server is not started at all and those Contour instances will not reach ready state.
Note that leader instance still worked correctly even when the conditions were true. This is because leader election triggers "fake" DAG update and therefore the same code path gets executed as if informer delivered some relevant resources that necessitated DAG rebuild - and therefore XDS server start.
The change adds explicit checks to cover the conditions (1) and (2).
Background:
Prior to #5672 we had hardcoded timer that triggered start of XDS server regardless of DAG rebuild status - even if it was not built at all. Starting from 1.27.0 we wait until all relevant resources have been received from the API server and then build the initial DAG. Back then it was not considered that there might not be initial resources and no initial DAG to build at all.
Fixes #6291