Conversation
fourhu
force-pushed
the
feature/issue-853
branch
from
September 21, 2026 10:39
0491475 to
388ffbd
Compare
fourhu
force-pushed
the
feature/issue-853
branch
from
September 21, 2026 13:10
388ffbd to
353d51c
Compare
fourhu
force-pushed
the
feature/issue-853
branch
from
September 21, 2026 13:24
353d51c to
1defcc2
Compare
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.
Fixes #853.
Replaces #855.
Summary
Add
--namespace-label-selectorfor clusters where namespace membership is controlled by labels instead of a fixed name list.Matching a namespace for the first time starts per-namespace resource informers. Removing the label keeps those informers running and keeps the store up to date, but drops the namespace from the generated HAProxy configuration until it matches again. Relabeling does not start a new list/watch because the store is already current. Deleting a Namespace object stops its informers; a same-name replacement is accepted only after that drain completes.
--namespace-whitelistand--namespace-blacklistkeep precedence. If either is set, the selector is ignored with a warning. With the selector unset, the existing informer path is unchanged.The
--configmapnamespace is always watched (same idea as whitelist mode), so controller defaults stay readable without that namespace carrying the selector labels. Its Ingresses and Gateways still need the selector. Other namespaces the controller reads through the store (publish-service, default-backend, default certificate, custom-validation-rules) must match the selector.Implementation
Relevant).--namespace-selector-ready-timeout(default30s) bounds how long bootstrap waits for those sessions before the first config sync.0waits indefinitely. Namespaces that become ready later still enter configuration.parentReftargets honor the same eligibility rules.networking.k8s.io/v1discovery probe is not cached as "API absent", so a transient error can recover on the next session start.Validation
Unit coverage for session lifecycle, stale epochs, teardown, bootstrap ordering, late CRDs, TCP services, Gateway references and non-selector compatibility.
The local kind suite runs 20 sequential selector scenarios. It covers startup selection, label/unlabel/relabel, set-based selectors, two matching namespaces, dormant Ingress and Service/EndpointSlice updates, bootstrap churn, namespace deletion and same-name replacement, v1 and v3 TCP CRs, late CRD discovery, and whitelist/blacklist precedence.
Local checks on the final commit:
NAMESPACE_SELECTOR_ISOLATED_CRD_TEST=1 go test -tags=e2e_sequential ./deploy/tests/e2e/namespace-selector -v -count=1go test -race ./pkg/k8s ./pkg/haproxy/api ./pkg/gateways -count=1go test ./...Trade-off
The selector path creates informer factories per selected namespace. API traffic and goroutine count grow with the number of namespaces that have ever matched, not only those that currently match: unlabeled namespaces keep their watches until the Namespace object is deleted. Namespace discovery watches all Namespace objects and matches locally. This option is intended for a bounded tenant set. Leaving the flag unset keeps the current shared-informer behavior.