Skip to content

CNTRLPLANE-3386: Required scc annotation checker updates - #31325

Open
liouk wants to merge 3 commits into
openshift:mainfrom
liouk:required-scc-annotation-checker-updates
Open

CNTRLPLANE-3386: Required scc annotation checker updates#31325
liouk wants to merge 3 commits into
openshift:mainfrom
liouk:required-scc-annotation-checker-updates

Conversation

@liouk

@liouk liouk commented Jun 23, 2026

Copy link
Copy Markdown
Member

This PR does the following updates in the required-scc-annotation-checker monitor test:

  1. Ignore run-level namespaces: skip namespaces labeled with openshift.io/run-level since SCC admission does not run on them, instead of carrying them as pending exceptions.
  2. Remove pending namespaces mechanism: all previously pending namespaces have been fixed, so the namespacesWithPendingSCCPinning list and its flake-on-failure behavior are removed. System namespaces now cause a hard failure instead of a flake.
  3. Ignore specific proprietary workloads: skip Nutanix CSI pods (nutanix-csi, nutanix-csi-controller, nutanix-csi-operator-controller-manager) that we cannot pin a required SCC to. Matching uses both exact and prefix comparison to handle Deployment-owned pods whose ReplicaSet names include a hash suffix.
  4. Refactor namespace filtering into a dedicated shouldSkipNamespace helper for readability.

Dependencies

This PR depends on the following fix-PRs:

Summary by CodeRabbit

  • Bug Fixes
    • Improved required security-context monitoring accuracy by excluding infrastructure, managed-service, and non-applicable workloads from validation.
    • Reduced false positives by refining which namespaces and workloads are evaluated.
    • Removed misleading extra success results, making monitoring test outcomes more consistent and reliable.

@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: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 23, 2026

Copy link
Copy Markdown

@liouk: This pull request references CNTRLPLANE-3386 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This PR does the following updates in the required-scc-annotation-checker monitor test:

  1. Ignores CatalogSource pods. CatalogSource objects spawn a pod that serves operator metadata for OLM discovery purposes; however the API does not expose a way to configure pod template annotations. Therefore we have to ignore catalog sources from the required-scc invariant.
  2. Ignores runlevel namespaces instead of flaking
  3. Removes list of pending namespaces; all remaining namespaces have been fixed, therefore we do not need to carry this exception mechanism any longer.

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-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

monitortest.go centralizes namespace and pod filtering. It excludes managed, system, run-level, non-openshift-, must-gather, and proprietary workloads before SCC annotation validation.

Changes

Required-SCC Monitor Filtering

Layer / File(s) Summary
Filtering rules and monitor integration
pkg/monitortests/authentication/requiredsccmonitortests/monitortest.go
Adds ignoredWorkloads, shouldSkipNamespace, and shouldSkipPod. CollectData applies both filters before pod validation. The hardcoded pending-SCC namespace set and extra successful JUnit result are removed.

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

Suggested reviewers: sjenning, p0lyn0mial


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❌ Error CollectData builds testName with runtime ns.Name at line 149 and assigns it to each JUnit Name, so test titles vary with cluster namespaces. Use a static JUnit test name. Put the namespace name only in failure output or another test-body field.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (13 passed)
Check name Status Explanation
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.
Test Structure And Quality ✅ Passed The PR modifies a monitor test framework implementation (MonitorTest interface), not Ginkgo test code. The custom check applies only to Ginkgo tests, which this file does not contain.
Microshift Test Compatibility ✅ Passed This PR modifies a monitor test (not a Ginkgo e2e test). It uses only Kubernetes core APIs (Pod, Namespace) and pod annotations—no new unavailable OpenShift APIs are introduced. SecurityContextCons...
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR changes only a monitor test Go file; it adds no Ginkgo It/Describe/Context/When test and contains no multi-node or HA assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The only changed file is an SCC monitor test; the diff adds pod filtering and no deployment, controller, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The modified file contains no process-level stdout writes. No fmt.Print*, log.Print, or klog calls exist. All fmt.Sprintf usage is internal only. No main(), init(), or suite-level functions are pre...
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR changes one monitor implementation and adds no Ginkgo tests; it contains no IPv4 literals, URL construction, or external connectivity requirements.
No-Weak-Crypto ✅ Passed File contains no weak cryptography, custom crypto implementations, or non-constant-time secret comparisons. Code uses only standard Kubernetes libraries for annotation and namespace filtering.
Container-Privileges ✅ Passed The PR modifies a read-only monitoring test that audits SCC annotations. It contains no container deployment, privilege escalation configuration, or security constraint modifications. The code only...
No-Sensitive-Data-In-Logs ✅ Passed The change adds workload filtering only. No new log sink or secret-bearing fields were added; existing JUnit output contains Kubernetes pod, namespace, owner, and SCC identifiers only.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updates to the required-scc-annotation-checker monitor test, aligning with the PR objectives of ignoring system namespaces and removing pending namespace lists.
✨ 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 requested review from p0lyn0mial and sjenning June 23, 2026 08:43
@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: liouk
Once this PR has been reviewed and has the lgtm label, please assign smg247 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 added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 23, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@liouk
liouk force-pushed the required-scc-annotation-checker-updates branch from b9ff22b to 51eaa69 Compare June 24, 2026 13:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/monitortests/authentication/requiredsccmonitortests/monitortest.go`:
- Line 84: The pod filtering in CollectData only skips entire namespaces, so
CatalogSource-owned pods in allowed namespaces still reach the SCC validation
path. Update the pod-processing logic in CollectData to add an explicit owner
check for CatalogSource before calling the RequiredSCCAnnotation validation,
using the existing namespace skip helper and the pod iteration flow to keep the
exclusion at the pod level.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 7d959271-f444-4097-bcc5-f7dc5f1c240e

📥 Commits

Reviewing files that changed from the base of the PR and between b9ff22b and 51eaa69.

📒 Files selected for processing (1)
  • pkg/monitortests/authentication/requiredsccmonitortests/monitortest.go

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/monitortests/authentication/requiredsccmonitortests/monitortest.go`:
- Around line 102-105: Update the shouldSkipPod function to add an explicit
owner-kind check for CatalogSource, in addition to the existing ignoredWorkloads
lookup. The function should return true when a pod is owned by a CatalogSource,
ensuring that pods owned by CatalogSource are properly skipped during SCC
validation regardless of their namespace or name.
- Around line 50-55: Update shouldSkipPod to account for the actual controller
kind behind each ignored workload: when an ignored workload is
Deployment-managed, resolve the ReplicaSet owner to the Deployment name or use
an appropriate generated-name prefix match instead of exact matching owner.Name.
Verify all three ignoredWorkloads entries against their controller types,
preserving exact matching for non-Deployment controllers.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 1d310279-6d36-4912-bec0-cb6fea4e21dc

📥 Commits

Reviewing files that changed from the base of the PR and between 51eaa69 and a0cc1e6.

📒 Files selected for processing (1)
  • pkg/monitortests/authentication/requiredsccmonitortests/monitortest.go

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

…pin an SCC to

In case of proprietary workloads, or workloads for which we do not have
a way of modifying their deployment to add the annotation to.
@liouk
liouk force-pushed the required-scc-annotation-checker-updates branch from a0cc1e6 to 97ca722 Compare August 4, 2026 13:15
@liouk liouk changed the title WIP: CNTRLPLANE-3386: Required scc annotation checker updates CNTRLPLANE-3386: Required scc annotation checker updates Aug 4, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 4, 2026
@liouk

liouk commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Holding until all dependency PRs listed in the description get merged.

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 4, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@liouk: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-serial-2of2 97ca722 link true /test e2e-aws-ovn-serial-2of2
ci/prow/e2e-gcp-csi 97ca722 link true /test e2e-gcp-csi
ci/prow/e2e-aws-ovn-serial-1of2 97ca722 link true /test e2e-aws-ovn-serial-1of2
ci/prow/e2e-gcp-ovn 97ca722 link true /test e2e-gcp-ovn

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

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants