diff --git a/docs/changelog.md b/docs/changelog.md index c8b8261e6..dff5a882c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -37,6 +37,10 @@ Each revision is versioned by the date of the revision. - docs: Updated the home page to implement the new pattern for the "In this documentation" section. - docs: Reorganized two tutorials to how-to section; expanded the upgrade guide +## 2026-04-21 + +- Do not render the default backend if there are no other backends in in the haproxy-route-tcp. + ## 2026-04-17 - Added missing settings from haproxy-route-tcp relation template. diff --git a/docs/release-notes/artifacts/pr0476.yaml b/docs/release-notes/artifacts/pr0476.yaml new file mode 100644 index 000000000..bcb22900d --- /dev/null +++ b/docs/release-notes/artifacts/pr0476.yaml @@ -0,0 +1,14 @@ +version_schema: 2 +changes: + - title: Do not render the default backend if there are no other backends + author: skatsaounis + type: bugfix + description: > + Do not render the default backend if there are no other backends in the + haproxy-route-tcp relation template, to avoid rendering unused + configuration. + urls: + pr: + - https://github.com/canonical/haproxy-operator/pull/476 + visibility: public + highlight: false diff --git a/haproxy-operator/templates/haproxy_route_tcp.cfg.j2 b/haproxy-operator/templates/haproxy_route_tcp.cfg.j2 index 3fa3e4919..65a48823d 100644 --- a/haproxy-operator/templates/haproxy_route_tcp.cfg.j2 +++ b/haproxy-operator/templates/haproxy_route_tcp.cfg.j2 @@ -101,8 +101,8 @@ backend {{ frontend.default_backend_name }} {% endfor %} {% endif %} -{# Render each backend for the frontend. #} -{% for backend in frontend.backends %} +{# Render each backend for the frontend. Skip rendering if there's only the default backend. #} +{% for backend in frontend.backends if frontend.backends|length > 1 %} backend {{ backend.name }} mode tcp {% if backend.dst_port_translation %}