Repository navigation
feat(haproxy-route): support a configurable default backend - #674
Open
Thanhphan1147 wants to merge 10 commits into
Open
Thanhphan1147 wants to merge 10 commits into
Thanhphan1147 wants to merge 10 commits into
Conversation
Add a `default_backend` boolean to the haproxy-route v2 library. A requirer application can set it to designate its backend as the default landing page for requests that do not match any configured hostname/backend. - The library rejects all requesting backends when more than one requirer sets the flag, marking their relation ids as invalid. - The charm renders the default backend without any ACL and uses it as the target of the `default_backend` directive. The inline "Default page for the haproxy-operator charm" backend is only rendered when no requirer requests to be the default backend. - The default backend still renders as a normal backend (servers, health checks, timeouts, rewrites, ...). Bump LIBPATCH to 5. Implements #664
Thanhphan1147
enabled auto-merge (squash)
October 6, 2026 19:37
Thanhphan1147
disabled auto-merge
October 6, 2026 19:37
Thanhphan1147
commented
Oct 7, 2026
Thanhphan1147
commented
Oct 7, 2026
Thanhphan1147
commented
Oct 7, 2026
Co-authored-by: Thanhphan1147 <42444001+Thanhphan1147@users.noreply.github.com>
Co-authored-by: Thanhphan1147 <42444001+Thanhphan1147@users.noreply.github.com>
Thanhphan1147
commented
Oct 7, 2026
… selection Co-authored-by: Thanhphan1147 <42444001+Thanhphan1147@users.noreply.github.com>
Collaborator
Author
|
[merge bot]: This PR is now being monitored to automatically rerun failing tests |
Thanhphan1147
enabled auto-merge (squash)
October 8, 2026 11:59
f-atwi
approved these changes
Oct 9, 2026
Comment on lines
+294
to
+301
| def is_default_backend(self) -> bool: | ||
| """Return whether this backend is the default landing page. | ||
|
|
||
| Returns: | ||
| bool: True if this backend is requested as the default backend. | ||
| """ | ||
| return self.application_data.default_backend | ||
|
|
Contributor
There was a problem hiding this comment.
i think there is no need to have this as a property
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Implements #664 by allowing a
haproxy-routerequirer to designate its backend as the default landing page for requests that do not match any configured hostname/backend.A new boolean
default_backendis added to thehaproxy-routev2 library. A default backend:acl_path_*,acl_host_*,acl_deny_path_*,use_backend),default_backenddirective in the frontend,When no requirer requests the flag, the existing inline
backend defaultresponse (Default page for the haproxy-operator charm) is kept.If more than one requirer sets
default_backend, all requesting backends are rejected (their relation ids are added torelation_ids_with_invalid_data) and the inline default is used.Related PR: canonical/ingress-configurator-operator#221
Changes
lib/charms/haproxy/v2/haproxy_route.py: newdefault_backendfield/parameter + single-default-backend validation.LIBPATCHbumped to 5.src/state/haproxy_route.py:HAProxyRouteBackend.is_default_backendandHaproxyRouteRequirersInformation.default_backend(gRPC backends excluded).src/haproxy.py: pass the resolved default backend to the template.templates/haproxy.cfg.j2,templates/haproxy_route.cfg.j2: render the requirer backend asdefault_backendtarget; only render the inline default when unset.Tests