Repository navigation
fix(router): Stop VIP binding status writes conflicting with health - #1576
Conversation
On a node whose ServiceVIPBindings use a FailClosed health check, the servicevipbinding controller logged a reconcile error every few minutes, enough to keep the reconcile error-floor alert firing. Each error was a conflict on the binding's status write. Retries succeeded, so traffic was unaffected. The backend health checker in the same router patches status.health after every FailClosed probe, because lastProbeTime changes each time. reconcileBind then wrote the whole status with a resourceVersion-checked Update from its cached copy, on every reconcile, whether or not anything changed. Any health patch that landed between the read and the write made it fail. Each health patch also re-ran the binding and, through the peer watch, every other binding on the node, so a node with a few bindings reconciled several times a second. reconcileBind now writes status only when it changes, as a merge patch of the fields it owns. The patch has no resourceVersion, so it cannot conflict with the health patch, and the health checker's own patch never touches the Bound condition. These are the only two writers of this status. A retry on conflict would hide the race and keep the redundant write, so it was not used. The For watch and the peer watch now drop updates that change only the status. Updates still pass when the generation, labels, annotations, finalizers or deletion timestamp change, and resyncs pass so the periodic datapath re-check still runs. Peer conflict resolution reads only spec and deletion state, so peers lose nothing. The backend health guide claimed one health patch per transition. It now says FailClosed patches once per probe interval, documents lastProbeTime and states the Bound write contract. Fixes #1380
The Bound status write is a JSON merge patch, which replaces the whole status.conditions list. Say in reconcileBind's comment that this reconciler must stay the only writer of that list, so a second writer added later does not have its conditions silently dropped. Related to #1380
|
Two independent reviews ran on aa95a23, and both returned merge. The correctness review built, vetted and ran the binding tests in the controller package. Its one nit was that a merge patch replaces the whole conditions list, so the binding reconciler has to stay its only writer. e5b2a61 adds that note to the code comment. The conventions review checked reach and open-PR collisions and found none, because no manifest or overlay changed. Both new regression tests fail on main at 2d5d35b. The health-patch race fails with the same "object was modified" conflict, and an unchanged binding gets 3 status writes over 3 reconciles. Both pass with this change. All required checks pass on e5b2a61, including E2E and root unit tests. Auto-merge is left off, so this needs a person to merge after approval. |
Summary
On nodes with FailClosed health-checked VIP bindings, the router's binding controller kept failing its status writes with "object has been modified", which kept the reconcile error-floor alert firing even though retries succeeded and traffic was unaffected.
The health checker patches the binding's health status after every probe, while the binding controller rewrote the whole status from its cache on every reconcile and re-ran every binding on the node for each probe.
The binding controller now writes status only when it changes, as a merge patch that cannot conflict with the health patch, and ignores updates that change only the status.
The API is unchanged, so rollback is a plain downgrade.
Test plan
Fixes #1380