Use true leader elector for controller counting #680
Merged
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.
Signed-off-by: Jussi Nummelin jnummelin@mirantis.com
Issue
The previous iteration (#672) was reaching to correct
--server-count
but doing so it did make the process flap quite a bit. And the flapping made the agents confused to which and how many servers they should connect to. That resulted in various errors e.g. during conformance testing where much of the verifications rely on getting logs and execs into pods. One of the most notable side-effects of the connection flapping was that metrics API endpoint caused lots of errors in many kube API calls. (the way it's wired up into k8s api is PITA, but that's a different battle)What this PR Includes
This PR changes the controller lease to use real leader election. Why? It's more accurate as the leases are updated more often and bit more battle tested. The downside is that it'll use bit more CPU time.
Also changes a bit the way konnectivity-server is restarted. Now there's separate routines to count the controllers and to restart the k-server with a channel in between to pass the controller counts. This proved to be pretty stable way to reach to the correct server count:
After which the process has been fully stable:
The added stability also makes the conformance pass: