[gw api] Fix overwrite of route status #4309
Merged
+215
−103
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.
Description
There is a possibility for the Gateway reconciler to enter an infinite loop when there's a partially working route. The flow is that a route gets it's status updated to accepted = false, however the previous implementation would always set all route statuses that got loaded to accepted = true. This behavior would cause the status to get overwritten and cause another gateway reconcile loop to get kicked off.
I approached the fix by refactoring the code to do route status updates in one place, and removed the route reconciler injection in other places and centralized the reconciler enqueue in the route mapper. By centralizing the enqueue logic, I was able to implement dedupe logic to prevent one reconcile cycle from writing a route status more than once.
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯