feat: gate the WAF management UI on the waf-ui-config ConfigMap - #5001
Open
electricjesus wants to merge 1 commit into
Open
feat: gate the WAF management UI on the waf-ui-config ConfigMap#5001electricjesus wants to merge 1 commit into
electricjesus wants to merge 1 commit into
Conversation
electricjesus
marked this pull request as ready for review
July 10, 2026 09:55
electricjesus
force-pushed
the
seth/waf-bff-ui-apis-env
branch
from
July 30, 2026 16:27
5d987e1 to
cab6653
Compare
The WAF management UI is gated per cluster by the waf-ui-config ConfigMap in calico-system, keyed waf-ui-enabled. An admin creates and edits it; the operator only reads it. A missing ConfigMap, a missing key or an unparsable value all read as disabled, so the feature stays off until an admin turns it on and deleting the switch turns it back off. Unlike the RBAC gate, ui-apis does not watch this ConfigMap. It reads WAF_UI_ENABLED at startup, so the operator projects the admin's value onto the container and a toggle rolls the manager Deployment. tigera-network-admin gets write access to the switch alongside the RBAC one, ungated, since a rule rendered only while the feature is on could never be used to turn it on. This controls UI visibility only. WAF enforcement on traffic is still configured through GatewayAPI.spec.extensions.waf. EV-6793
electricjesus
force-pushed
the
seth/waf-bff-ui-apis-env
branch
from
August 10, 2026 16:39
cab6653 to
a0ce166
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.
Jira: https://tigera.atlassian.net/browse/EV-6793
Description
New feature. This turns the WAF management UI on or off per cluster, using the
waf-ui-configConfigMap incalico-system, keyedwaf-ui-enabled. An admin creates and edits it. The operator only reads it.A missing ConfigMap, a missing key, or a value it cannot parse all read as disabled. So the feature stays off until an admin turns it on, and deleting the switch turns it back off.
This PR used to add a
wafUIfield to the Manager CRD, copying the oldrbacUIfield. #5114 replaced that pattern with the ConfigMap gate and deletedspec.rbacUI, so this now follows the same shape. No CRD change and no API change.One difference from the RBAC gate. ui-apis watches
rbac-ui-configand picks up a change live. It does not watch the WAF one: it readsWAF_UI_ENABLEDat startup (seeui-apis/pkg/server/config.go). So the operator reads the ConfigMap and writes the value onto the container, and flipping the switch rolls the manager Deployment. Moving ui-apis onto a live read would be a nice follow-up, and it would drop the env var.tigera-network-admingets write access to the switch, next to the RBAC one, ungated. A rule that only shows up while the feature is on could never be used to turn it on.This only controls whether the WAF management UI shows up. It does not turn on WAF enforcement, which is still configured through
GatewayAPI.spec.extensions.waf. The two are meant to be independent.The ui-apis half is already merged: https://github.com/tigera/calico-private/pull/12655 adds the
/waf/v1routes behindWAF_UI_ENABLED.No kube-controllers change. The WAF handlers impersonate the calling user, and the end-user WAF CRD permissions already exist in the apiserver.
Affected component: operator (manager render, apiserver render, manager controller).
Testing:
go test ./pkg/render/ ./pkg/render/common/wafmanagement/ ./pkg/controller/manager/ ./pkg/controller/utils/ ./pkg/controller/apiserver/all pass.wafmanagementgate specs cover nil, missing key,true,True,1,false, junk, and empty.WAF_UI_ENABLEDtracks the flag both ways.true,false, and an unreadable ConfigMap degrading instead of reading as off.tigera-network-adminrule fixtures inapiserver_test.gofor the new resource name.Release Note
For PR author
make gen-filesmake gen-versionsFor PR reviewers
A note for code reviewers - all pull requests must have the following:
kind/bugif this is a bugfix.kind/enhancementif this is a a new feature.enterpriseif this PR applies to Calico Enterprise only.