feat(ctl): filter frontend list by cluster id - #1321
Open
KannarFr wants to merge 1 commit into
Open
Conversation
`sozu frontend list` could only be narrowed by protocol and by domain, so answering "which frontends belong to this cluster, and what access-log tags do they carry?" meant dumping every frontend and filtering client-side. `FrontendFilters` gains an optional `cluster_id` (proto tag `5`), wired to `sozu frontend list -i/--cluster-id <id>`. `ConfigState::list_frontends` applies it to HTTP, HTTPS, TCP and UDP frontends, ANDed with the existing protocol and `--domain` filters. TCP and UDP frontends are keyed by cluster id in the state, so the filter is applied to the map key; HTTP/HTTPS frontends carry an optional cluster id, and a frontend that denies traffic (no cluster id) therefore never matches. Covered by `list_frontends_filters_by_cluster_id`, which asserts both the positive and the negative space: the wanted frontend of every protocol is listed, no other cluster's frontend leaks through, an unknown id matches nothing, a `Deny` frontend is never selected, and `cluster_id` composes with (rather than replaces) the protocol and domain filters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: kannar <kannarfr@gmail.com>
KannarFr
requested review from
FlorentinDUBOIS,
Wonshtrum and
llenotre
as code owners
September 9, 2026 15:17
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.
What
sozu frontend listcould only be narrowed by protocol and by domain. Answering "which frontends belong to this cluster, and what access-log tags do they carry?" meant dumping every frontend and filtering client-side.FrontendFiltersgains an optionalcluster_id(proto tag5), wired tosozu frontend list -i/--cluster-id <id>:ConfigState::list_frontendsapplies the filter to HTTP, HTTPS, TCP and UDP frontends, ANDed with the existing protocol and--domainfilters. TCP and UDP frontends are keyed by cluster id in the state, so the filter is applied to the map key; HTTP/HTTPS frontends carry an optional cluster id, and a frontend that denies traffic (no cluster id) therefore never matches.Protocol / security impact
optionalfield onFrontendFiltersat an unused tag. An older client omits it and gets the previous (unfiltered) behaviour; an older main process ignores it. No worker-facing message changes.Tests
Added
list_frontends_filters_by_cluster_id(command/src/state.rs), asserting both the positive and the negative space: the wanted frontend of every protocol is listed, no other cluster's frontend leaks through, an unknown id matches nothing, aDenyfrontend is never selected, andcluster_idcomposes with (rather than replaces) the protocol and domain filters.Commands run
Also exercised against a running proxy:
frontend list -i MyClusternarrows a two-cluster state to one cluster's frontends, andfrontend list -i nopereturns nothing.Docs
CHANGELOG.md—[Unreleased] / ✨ Added.🤖 Generated with Claude Code