Skip to content

fix(#4770): Fix status-only startup without initializing the constraint client - #4780

Open
7487 wants to merge 1 commit into
open-policy-agent:masterfrom
7487:fix/issue-4770-fix-status-only-startup-without-initiali
Open

fix(#4770): Fix status-only startup without initializing the constraint client#4780
7487 wants to merge 1 commit into
open-policy-agent:masterfrom
7487:fix/issue-4770-fix-status-only-startup-without-initiali

Conversation

@7487

@7487 7487 commented Aug 25, 2026

Copy link
Copy Markdown

What this PR does / why we need it

HasValidationOperations currently classifies status as policy validation. A status-only process therefore constructs a constraint client without an audit or webhook enforcement point and fails during startup. It also starts validation ingestion controllers that status aggregation does not need.

This change:

  • scopes validation operations to audit and webhook;
  • registers only the Constraint and ConstraintTemplate status aggregators in status-only mode;
  • lets the Constraint status aggregator read from the API-backed manager client when there is no validation dynamic watch;
  • keeps the existing dynamic-watch path for audit/webhook combinations; and
  • adds the root package to native test targets so status-only controller setup remains covered.

Verification

  • TDD red phase: TestHasValidationOperations/status_only failed before the predicate fix.
  • go test ./pkg/operations ./pkg/controller/constraintstatus ./pkg/controller/constrainttemplate ./pkg/controller/constrainttemplatestatus
  • go test . -run TestSetupControllersStatusOnly with Kubernetes 1.33 envtest assets
  • make native-test
  • make native-race-test
  • golangci-lint v2.9.0 run . ./pkg/operations/... ./pkg/controller/constraintstatus/... ./pkg/controller/constrainttemplate/... (0 issues)
  • go vet ./...
  • go build ./...
  • direct manager and gator binary builds with the repository's version ldflag

Fixes #4770

Signed-off-by: 7487 <1042653432@qq.com>
@7487
7487 requested a review from a team as a code owner August 25, 2026 02:47
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix status-only startup without initializing the constraint client

1 participant