Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG/MINOR: prevents clash on custom routes names to avoid unecessary restarts #569

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

fabianonunes
Copy link
Contributor

@fabianonunes fabianonunes commented Sep 2, 2023

Fixes #567

All custom routes are stored in the routes.CustomRoutes map using the backend name as the key (ServiceNS_ServiceName_PortName). When we encounter two distinct IngressRules, whether they are within the same Ingress or not, and they utilize different hosts or paths while pointing to the same Service, they end up sharing the same key in CustomRoutes. This similarity in keys results in comparison failures during every synchronization, requiring a hard reload of HAProxy.

Rather than storing the custom routes in a map keyed by backend name, this PR stores all the resulting use_backend directives in a slice and compares them between syncs.

@fabianonunes fabianonunes force-pushed the prevent-route-name-clash branch 6 times, most recently from 62354a1 to e490d62 Compare September 2, 2023 21:27
@fabianonunes fabianonunes marked this pull request as ready for review September 4, 2023 02:08
@fabianonunes fabianonunes force-pushed the prevent-route-name-clash branch 4 times, most recently from dfe0b1b to 7b482b3 Compare September 4, 2023 02:14
@fabianonunes fabianonunes marked this pull request as draft September 4, 2023 10:28
@fabianonunes fabianonunes force-pushed the prevent-route-name-clash branch 3 times, most recently from 7f39404 to 5bf5c24 Compare September 4, 2023 14:03
@fabianonunes fabianonunes marked this pull request as ready for review September 4, 2023 14:08
…restarts

All custom routes are stored in the `routes.CustomRoutes` map using
the backend name as the key (`ServiceNS_ServiceName_PortName`).
When we encounter two distinct IngressRules, whether they are within
the same Ingress or not, and they utilize different hosts or paths
while pointing to the same Service, they end up sharing the same
key in `CustomRoutes`. This similarity in keys results in comparison
failures during every synchronization, requiring a hard reload of
HAProxy.

Rather than storing the custom routes in a map keyed by backend name,
this commit stores all the resulting use_backend directives in a
slice and compares them between syncs.
@oktalz oktalz merged commit 4d9884b into haproxytech:master Sep 7, 2023
7 checks passed
@oktalz
Copy link
Member

oktalz commented Sep 7, 2023

@fabianonunes thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order of "use_backend" lines in haproxy.cfg is inconsistent (changes every 5 seconds)
2 participants