Skip to content

feat: gate the WAF management UI on the waf-ui-config ConfigMap - #5001

Open
electricjesus wants to merge 1 commit into
masterfrom
seth/waf-bff-ui-apis-env
Open

feat: gate the WAF management UI on the waf-ui-config ConfigMap#5001
electricjesus wants to merge 1 commit into
masterfrom
seth/waf-bff-ui-apis-env

Conversation

@electricjesus

@electricjesus electricjesus commented Jul 10, 2026

Copy link
Copy Markdown
Member

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-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 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 wafUI field to the Manager CRD, copying the old rbacUI field. #5114 replaced that pattern with the ConfigMap gate and deleted spec.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-config and picks up a change live. It does not watch the WAF one: it reads WAF_UI_ENABLED at startup (see ui-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-admin gets 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/v1 routes behind WAF_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.
  • New wafmanagement gate specs cover nil, missing key, true, True, 1, false, junk, and empty.
  • New manager render specs assert WAF_UI_ENABLED tracks the flag both ways.
  • New manager controller specs cover no ConfigMap, true, false, and an unreadable ConfigMap degrading instead of reading as off.
  • Updated the tigera-network-admin rule fixtures in apiserver_test.go for the new resource name.

Release Note

Added the waf-ui-config ConfigMap in calico-system to enable the WAF management UI.

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

@marvin-tigera marvin-tigera added this to the v1.44.0 milestone Jul 10, 2026
@electricjesus
electricjesus marked this pull request as ready for review July 10, 2026 09:55
@electricjesus
electricjesus requested review from a team and marvin-tigera as code owners July 10, 2026 09:55
@electricjesus
electricjesus force-pushed the seth/waf-bff-ui-apis-env branch from 5d987e1 to cab6653 Compare July 30, 2026 16:27
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
electricjesus force-pushed the seth/waf-bff-ui-apis-env branch from cab6653 to a0ce166 Compare August 10, 2026 16:39
@electricjesus electricjesus changed the title feat: gate the WAF management UI via Manager.spec.wafUI feat: gate the WAF management UI on the waf-ui-config ConfigMap Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants