Skip to content

Reject WatchList requests for Project resources - #673

Open
sanchezl wants to merge 1 commit into
openshift:mainfrom
sanchezl:fix-project-watchlist-reject
Open

Reject WatchList requests for Project resources#673
sanchezl wants to merge 1 commit into
openshift:mainfrom
sanchezl:fix-project-watchlist-reject

Conversation

@sanchezl

@sanchezl sanchezl commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Reject WatchList requests for Project resources because the Project watch handler does not support the sendInitialEvents protocol.

Summary by CodeRabbit

  • Bug Fixes

    • Project watch requests using initial event delivery are now rejected with a clear “method not supported” error.
    • Existing watch behavior remains unchanged for supported request options.
  • Tests

    • Added coverage to verify unsupported initial-event watch requests are handled correctly.

The Project Watch handler cannot properly serve the WatchList protocol
(sendInitialEvents). When the WatchList feature gate is enabled,
SetListOptionsDefaults auto-upgrades Watch requests with RV="" to set
sendInitialEvents=true. Since ConvertNamespaceList does not propagate
ResourceVersion, Project LIST always returns RV="", causing all Project
watches to be upgraded.

The Project watcher uses RV=="0" to decide whether to include all
existing projects, not sendInitialEvents. When sendInitialEvents=true
with RV="", zero ADDED events are sent followed by a bookmark claiming
initial events are complete, making clients believe there are zero
projects.

Return MethodNotSupported when sendInitialEvents is set, which causes
client-go's reflector to fall back to standard LIST+WATCH semantics.
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4d4792d3-7089-47eb-b13c-fc463cdd05be

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab4a0e and a8a070d.

📒 Files selected for processing (2)
  • pkg/project/apiserver/registry/project/proxy/proxy.go
  • pkg/project/apiserver/registry/project/proxy/proxy_test.go

Walkthrough

REST.Watch now rejects requests with SendInitialEvents=true using a MethodNotSupported error. A test verifies the rejection.

Changes

Project watch-list validation

Layer / File(s) Summary
Reject SendInitialEvents requests
pkg/project/apiserver/registry/project/proxy/proxy.go, pkg/project/apiserver/registry/project/proxy/proxy_test.go
REST.Watch rejects SendInitialEvents=true before creating a watcher. The test verifies the MethodNotSupported error.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to a8a07

The change rejects unsupported Project WatchList requests so clients can use standard LIST+WATCH behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: tchap

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR adds a standard Go test, TestWatchRejectsSendInitialEvents, with a static name; it adds no Ginkgo title calls or dynamic test-title values.
Test Structure And Quality ✅ Passed The added test is a focused standard Go test, not Ginkgo; it creates no cluster resources, uses no waits, and provides meaningful messages for both error checks.
Microshift Test Compatibility ✅ Passed The diff adds only a standard Go TestWatchRejectsSendInitialEvents unit test; it adds no Ginkgo e2e test, so the MicroShift compatibility check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The commit adds a standard Go TestWatchRejectsSendInitialEvents unit test, not a new Ginkgo e2e test; it makes no SNO multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The diff changes only Project API proxy Watch handling and its test; it adds no deployment, operator, controller, replica, affinity, topology, node-selector, toleration, or PDB scheduling constraint.
Ote Binary Stdout Contract ✅ Passed The patch changes only REST.Watch and a unit test; neither adds stdout writes or process-level setup. The test uses t.Fatal/t.Errorf inside TestWatchRejectsSendInitialEvents, which is allowed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added test is a standard Go Test function, not a Ginkgo e2e test, and it contains no IPv4 assumptions or external connectivity.
No-Weak-Crypto ✅ Passed The PR adds only a SendInitialEvents check, MethodNotSupported return, and test; the added-line weak-crypto and secret-comparison scan found zero suspicious hits.
Container-Privileges ✅ Passed The pull request changes only Go handler and test files. It adds no container or Kubernetes manifest settings for privileged mode, host namespaces, SYS_ADMIN, root, or privilege escalation.
No-Sensitive-Data-In-Logs ✅ Passed The changed code adds only a MethodNotSupported error and test assertions; it introduces no logging and exposes no sensitive data.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes rejecting unsupported WatchList requests for Project resources.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign derekwaynecarr for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@sanchezl: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

1 participant