Skip to content

OCPBUGS-77762: Add an e2e to check the default network polocy#1334

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
hongkailiu:check-network-policy
Mar 7, 2026
Merged

OCPBUGS-77762: Add an e2e to check the default network polocy#1334
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
hongkailiu:check-network-policy

Conversation

@hongkailiu
Copy link
Copy Markdown
Member

@hongkailiu hongkailiu commented Mar 4, 2026

/hold

Wait for #1333

Summary by CodeRabbit

  • Tests
    • Added test validation to ensure the Cluster Version Operator has appropriate network policy configurations, with platform-specific exemptions for certain cluster types.

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Mar 4, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@hongkailiu: This pull request references Jira Issue OCPBUGS-77762, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @dis016

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

/hold

Wait for #1333

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 4, 2026

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: Pro

Run ID: fd1af458-61f5-48ae-8fde-162742a45c4c

📥 Commits

Reviewing files that changed from the base of the PR and between 54dc4ef and 5dcd2bc.

📒 Files selected for processing (2)
  • .openshift-tests-extension/openshift_payload_cluster-version-operator.json
  • test/cvo/cvo.go

Walkthrough

A new test case is added to verify that the Cluster Version Operator has a default-deny NetworkPolicy. The change includes both a test case entry in the manifest file and the corresponding test implementation in the Go test file.

Changes

Cohort / File(s) Summary
Cluster Version Operator Network Policy Test
.openshift-tests-extension/openshift_payload_cluster-version-operator.json, test/cvo/cvo.go
Added new test case "should have a network policy" that verifies the existence of a default-deny NetworkPolicy in the CVO namespace. Includes test definition registration and implementation with skip conditions for HyperShift/MicroShift platforms.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The test uses context.Background() without timeout and makes direct API calls, violating established timeout patterns. Assertion logic is inverted, silently passing without explicit NetworkPolicy verification. Refactor to use wait.PollUntilContextTimeout with appropriate timeouts matching codebase patterns, or use context.WithTimeout. Fix assertion logic to explicitly verify NetworkPolicy exists.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly references the Jira key (OCPBUGS-77762) and accurately describes the main change: adding an end-to-end test to verify the default network policy exists in the CVO namespace.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed The test name 'should have a network policy' is fully static, deterministic, and contains no dynamic information such as generated suffixes, timestamps, UUIDs, or random values.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@openshift-ci openshift-ci Bot requested a review from dis016 March 4, 2026 14:14
@openshift-ci openshift-ci Bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 4, 2026
Copy link
Copy Markdown
Member

@wking wking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray, detection works in `e2e-agnostic-ovn:

: [Jira:"Cluster Version Operator"] cluster-version-operator should have a network policy expand_less	0s
{  fail [github.com/openshift/cluster-version-operator/test/cvo/cvo.go:70]: Failed to get the default network policy
Unexpected error:
    <*errors.StatusError | 0xc000616140>: 
    networkpolicies.networking.k8s.io "default-deny" not found
    {
        ErrStatus: {
            TypeMeta: {Kind: "", APIVersion: ""},
            ListMeta: {
                SelfLink: "",
                ResourceVersion: "",
                Continue: "",
                RemainingItemCount: nil,
            },
            Status: "Failure",
            Message: "networkpolicies.networking.k8s.io \"default-deny\" not found",
            Reason: "NotFound",
            Details: {
                Name: "default-deny",
                Group: "networking.k8s.io",
                Kind: "networkpolicies",
                UID: "",
                Causes: nil,
                RetryAfterSeconds: 0,
            },
            Code: 404,
        },
    }
occurred}

/lgtm
/verified by e2e-agnostic-ovn

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Mar 4, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 4, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongkailiu, wking

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

The pull request process is described 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

@hongkailiu
Copy link
Copy Markdown
Member Author

/retest-required

/hold cancel

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 5, 2026
@hongkailiu
Copy link
Copy Markdown
Member Author

/retest-required

@hongkailiu
Copy link
Copy Markdown
Member Author

/test e2e-agnostic-ovn-techpreview-serial

@wking
Copy link
Copy Markdown
Member

wking commented Mar 6, 2026

techpreview-serial job timeout unrelated to this pull:

/override ci/prow/e2e-agnostic-ovn-techpreview-serial

probably needs to be sharded into two jobs.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 6, 2026

@wking: Overrode contexts on behalf of wking: ci/prow/e2e-agnostic-ovn-techpreview-serial

Details

In response to this:

[techpreview-serial job timeout][1] unrelated to this pull:

/override ci/prow/e2e-agnostic-ovn-techpreview-serial

probably needs to be sharded into two jobs.

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.

@hongkailiu
Copy link
Copy Markdown
Member Author

It adds a new case.
The risk is low.

/verified by @hongkailiu

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@hongkailiu: This PR has been marked as verified by @hongkailiu.

Details

In response to this:

It adds a new case.
The risk is low.

/verified by @hongkailiu

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 openshift-eng/jira-lifecycle-plugin repository.

@wking
Copy link
Copy Markdown
Member

wking commented Mar 6, 2026

Still not worried about that test vs. this pull.

/override ci/prow/e2e-agnostic-ovn-techpreview-serial

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 6, 2026

@wking: Overrode contexts on behalf of wking: ci/prow/e2e-agnostic-ovn-techpreview-serial

Details

In response to this:

Still not worried about that test vs. this pull.

/override ci/prow/e2e-agnostic-ovn-techpreview-serial

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.

@wking
Copy link
Copy Markdown
Member

wking commented Mar 7, 2026

HyperShift NodePool timeout is unrelated to this pull's CVO e2e change.

/override ci/prow/e2e-hypershift

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 7, 2026

@wking: Overrode contexts on behalf of wking: ci/prow/e2e-hypershift

Details

In response to this:

HyperShift NodePool timeout is unrelated to this pull's CVO e2e change.

/override ci/prow/e2e-hypershift

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.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 7, 2026

@hongkailiu: 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.

@openshift-merge-bot openshift-merge-bot Bot merged commit af5e95e into openshift:main Mar 7, 2026
17 checks passed
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@hongkailiu: Jira Issue Verification Checks: Jira Issue OCPBUGS-77762
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-77762 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

/hold

Wait for #1333

Summary by CodeRabbit

  • Tests
  • Added test validation to ensure the Cluster Version Operator has appropriate network policy configurations, with platform-specific exemptions for certain cluster types.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in accepted release 4.22.0-0.nightly-2026-03-07-091925

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants