Skip to content

OCPBUGS-62799: Add required-scc annotation to node-joiner pod #2230

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
cetinerdev:custom-scc-prevention
May 5, 2026
Merged

OCPBUGS-62799: Add required-scc annotation to node-joiner pod #2230
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
cetinerdev:custom-scc-prevention

Conversation

@cetinerdev
Copy link
Copy Markdown
Contributor

@cetinerdev cetinerdev commented Mar 18, 2026

When a third-party SCC (e.g. Pure Storage CSI) with readOnlyRootFilesystem: true and higher priority is broadly accessible via RBAC, the SCC admission controller may assign it to the node-joiner pod instead of restricted-v2. This causes the node-joiner tool to fail with 'read-only file system' errors when writing to /tmp.

Adding the openshift.io/required-scc annotation ensures restricted-v2 is always assigned regardless of other SCCs' priority or restrictiveness, as required by the custom SCC preemption prevention enhancement:
https://github.com/openshift/enhancements/blob/master/enhancements/authentication/custom-scc-preemption-prevention.md

Summary by CodeRabbit

  • Bug Fixes

    • Pod creation operations in node image utilities now include proper OpenShift security constraint annotations, ensuring pods are created with appropriate cluster security policies.
  • Tests

    • Added test coverage to validate that security constraint annotations are correctly applied during pod creation and monitoring operations.

@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/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 18, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@cetinerdev: This pull request references Jira Issue OCPBUGS-62799, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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

Details

In response to this:

When a third-party SCC (e.g. Pure Storage CSI) with readOnlyRootFilesystem: true and higher priority is broadly accessible via RBAC, the SCC admission controller may assign it to the node-joiner pod instead of restricted-v2. This causes the node-joiner tool to fail with 'read-only file system' errors when writing to /tmp.

Adding the openshift.io/required-scc annotation ensures restricted-v2 is always assigned regardless of other SCCs' priority or restrictiveness, as required by the custom SCC preemption prevention enhancement:
https://github.com/openshift/enhancements/blob/master/enhancements/authentication/custom-scc-preemption-prevention.md

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 18, 2026

Warning

Rate limit exceeded

@cetinerdev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 6 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 6 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: eadb35d0-51de-493a-a998-34c1b310d537

📥 Commits

Reviewing files that changed from the base of the PR and between 62434fc and d1931c3.

📒 Files selected for processing (4)
  • pkg/cli/admin/nodeimage/create.go
  • pkg/cli/admin/nodeimage/create_test.go
  • pkg/cli/admin/nodeimage/monitor.go
  • pkg/cli/admin/nodeimage/monitor_test.go

Walkthrough

Adds the openshift.io/required-scc: restricted-v2 annotation to node-joiner Pod metadata in both the create and monitor code paths, and extends tests to assert the annotation on generated Pods.

Changes

Cohort / File(s) Summary
Pod Annotation Updates
pkg/cli/admin/nodeimage/create.go, pkg/cli/admin/nodeimage/monitor.go
Set ObjectMeta.Annotations["openshift.io/required-scc"] = "restricted-v2" on the created node-joiner Pods in both create and monitor flows. No other Pod spec fields or control flow were changed.
Test Coverage
pkg/cli/admin/nodeimage/create_test.go, pkg/cli/admin/nodeimage/monitor_test.go
Added test cases that retrieve the generated node-joiner Pod and assert the openshift.io/required-scc annotation equals restricted-v2. Tests import corev1 where needed and add an expectedPod callback in monitor tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
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.
Test Structure And Quality ❓ Inconclusive Tests use standard Go table-driven patterns with testing.T, not Ginkgo (no Describe/It blocks, BeforeEach/AfterEach). Check requires Ginkgo framework but tests implement different framework. Clarify whether check applies to Ginkgo tests only, standard Go tests, or both frameworks with adapted criteria for each testing pattern used.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a required-scc annotation to the node-joiner pod, which aligns with all modifications across the four changed files.
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 Test case names in modified files are static and deterministic. The new test 'node-joiner monitor pod has required-scc annotation' contains no dynamic values, timestamps, UUIDs, or generated suffixes.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests are added; all changes are standard Go unit test cases.
Single Node Openshift (Sno) Test Compatibility ✅ Passed New test cases in create_test.go and monitor_test.go are standard Go unit tests using testing.T, not Ginkgo e2e tests, and contain no multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed This pull request adds only a pod annotation for SCC enforcement, which is orthogonal to scheduling and does not assume any specific cluster topology.
Ote Binary Stdout Contract ✅ Passed The PR modifies only pod metadata annotations in pkg/cli/admin/nodeimage/ without introducing any process-level stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Test files are standard Go unit tests using testing package, not Ginkgo e2e tests, so IPv6 and disconnected network compatibility check is not applicable.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from andfasano and rwsu March 18, 2026 13:39
@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 18, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 18, 2026

Hi @cetinerdev. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@tchap
Copy link
Copy Markdown
Contributor

tchap commented Apr 14, 2026

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 14, 2026
@rwsu
Copy link
Copy Markdown
Contributor

rwsu commented Apr 16, 2026

/retest-required

Copy link
Copy Markdown
Contributor

@rwsu rwsu left a comment

Choose a reason for hiding this comment

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

Some minor typos to correct. Otherwise looks good.

Comment thread pkg/cli/admin/nodeimage/create_test.go Outdated
remoteExecOutput: "0",
},
{
name: "node-joiner pod has required-scc annotation ",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: "node-joiner pod has required-scc annotation ",
name: "node-joiner pod has required-scc annotation",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread pkg/cli/admin/nodeimage/create_test.go Outdated
expected := "restricted-v2"
got := pod.Annotations["openshift.io/required-scc"]
if got != expected {
t.Errorf("annoation openshift.io/required-scc = %q, want %q", got, expected)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Errorf("annoation openshift.io/required-scc = %q, want %q", got, expected)
t.Errorf("annotation openshift.io/required-scc = %q, want %q", got, expected)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread pkg/cli/admin/nodeimage/create_test.go Outdated
got := pod.Annotations["openshift.io/required-scc"]
if got != expected {
t.Errorf("annoation openshift.io/required-scc = %q, want %q", got, expected)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mixed space/tab issue here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Labels: map[string]string{
"app": "node-joiner-monitor",
},
Annotations: map[string]string{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be great if a similar test for monitor can be created.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added missing test , and test is verified

@cetinerdev cetinerdev force-pushed the custom-scc-prevention branch from e920e51 to 62434fc Compare April 22, 2026 15:46
@cetinerdev
Copy link
Copy Markdown
Contributor Author

Addressed all review comments: fixed trailing space, typo, and mixed tabs/spaces in create_test.go. Added similar test for monitor in monitor_test.go.

@openshift-ci-robot
Copy link
Copy Markdown

@cetinerdev: This pull request references Jira Issue OCPBUGS-62799, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

When a third-party SCC (e.g. Pure Storage CSI) with readOnlyRootFilesystem: true and higher priority is broadly accessible via RBAC, the SCC admission controller may assign it to the node-joiner pod instead of restricted-v2. This causes the node-joiner tool to fail with 'read-only file system' errors when writing to /tmp.

Adding the openshift.io/required-scc annotation ensures restricted-v2 is always assigned regardless of other SCCs' priority or restrictiveness, as required by the custom SCC preemption prevention enhancement:
https://github.com/openshift/enhancements/blob/master/enhancements/authentication/custom-scc-preemption-prevention.md

Summary by CodeRabbit

  • Bug Fixes

  • Pod creation operations in node image utilities now include proper OpenShift security constraint annotations, ensuring pods are created with appropriate cluster security policies.

  • Tests

  • Added test coverage to validate that security constraint annotations are correctly applied during pod creation and monitoring operations.

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/cli/admin/nodeimage/monitor_test.go (1)

77-97: ⚠️ Potential issue | 🟡 Minor

Invoke expectedPod; the new assertion currently never runs.

Line 77 adds the hook and Lines 90-96 define the annotation check, but tc.expectedPod is never called after o.Run(). This means the new test passes even if the monitor pod annotation is removed.

🧪 Proposed fix
 			if tc.expectedError == "" {
 				if fakeLogContent != logContents.String() {
 					t.Errorf("expected %v, actual %v", fakeLogContent, logContents.String())
 				}
+				if tc.expectedPod != nil {
+					if o.nodeJoinerPod == nil {
+						t.Fatalf("expected node-joiner monitor pod to be created")
+					}
+					tc.expectedPod(t, o.nodeJoinerPod)
+				}
 			}

Also applies to: 143-149

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/cli/admin/nodeimage/monitor_test.go` around lines 77 - 97, The test
defines an expectedPod hook (tc.expectedPod) but never invokes it, so the
annotation assertion never runs; after invoking the command runner (the call to
o.Run(...) or equivalent in the test loop), add a conditional call like if
tc.expectedPod != nil { tc.expectedPod(t, createdPod) } so the provided
validation runs — do this in the table-driven test where the test cases are
iterated (the block that calls o.Run) and also apply the same fix for the second
table at lines ~143-149 so both sets of cases execute their expectedPod
callbacks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@pkg/cli/admin/nodeimage/monitor_test.go`:
- Around line 77-97: The test defines an expectedPod hook (tc.expectedPod) but
never invokes it, so the annotation assertion never runs; after invoking the
command runner (the call to o.Run(...) or equivalent in the test loop), add a
conditional call like if tc.expectedPod != nil { tc.expectedPod(t, createdPod) }
so the provided validation runs — do this in the table-driven test where the
test cases are iterated (the block that calls o.Run) and also apply the same fix
for the second table at lines ~143-149 so both sets of cases execute their
expectedPod callbacks.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 9566281a-6de4-493e-828f-1172bbeb5e51

📥 Commits

Reviewing files that changed from the base of the PR and between e920e51 and 62434fc.

📒 Files selected for processing (4)
  • pkg/cli/admin/nodeimage/create.go
  • pkg/cli/admin/nodeimage/create_test.go
  • pkg/cli/admin/nodeimage/monitor.go
  • pkg/cli/admin/nodeimage/monitor_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/cli/admin/nodeimage/monitor.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/cli/admin/nodeimage/create_test.go
  • pkg/cli/admin/nodeimage/create.go

…ent third-party SCC interference

When a third-party SCC (e.g. Pure Storage CSI) with readOnlyRootFilesystem: true
and higher priority is broadly accessible via RBAC, the SCC admission controller
may assign it to the node-joiner pod instead of restricted-v2. This causes the
node-joiner tool to fail with 'read-only file system' errors when writing to /tmp.

Adding the openshift.io/required-scc annotation ensures restricted-v2 is always
assigned regardless of other SCCs' priority or restrictiveness, as required by
the custom SCC preemption prevention enhancement:
https://github.com/openshift/enhancements/blob/master/enhancements/authentication/custom-scc-preemption-prevention.md
@cetinerdev cetinerdev force-pushed the custom-scc-prevention branch from 62434fc to d1931c3 Compare April 22, 2026 16:33
@cetinerdev
Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@cetinerdev: This pull request references Jira Issue OCPBUGS-62799, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.22.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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.

@cetinerdev
Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 22, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@cetinerdev: This pull request references Jira Issue OCPBUGS-62799, which is valid. The bug has been moved to the POST state.

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

Requesting review from QA contact:
/cc @mhanss

Details

In response to this:

/jira refresh

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 requested a review from mhanss April 22, 2026 17:11
Copy link
Copy Markdown
Contributor

@rwsu rwsu left a comment

Choose a reason for hiding this comment

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

/lgtm

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

openshift-ci Bot commented Apr 30, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cetinerdev, rwsu

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 30, 2026
@rwsu
Copy link
Copy Markdown
Contributor

rwsu commented May 5, 2026

/verified by unit tests: node-joiner pod has required-scc annotation

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

@rwsu: This PR has been marked as verified by unit tests: node-joiner pod has required-scc annotation.

Details

In response to this:

/verified by unit tests: node-joiner pod has required-scc annotation

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
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 5, 2026

@cetinerdev: 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 6ac0669 into openshift:main May 5, 2026
18 checks passed
@openshift-ci-robot
Copy link
Copy Markdown

@cetinerdev: Jira Issue Verification Checks: Jira Issue OCPBUGS-62799
✔️ 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-62799 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:

When a third-party SCC (e.g. Pure Storage CSI) with readOnlyRootFilesystem: true and higher priority is broadly accessible via RBAC, the SCC admission controller may assign it to the node-joiner pod instead of restricted-v2. This causes the node-joiner tool to fail with 'read-only file system' errors when writing to /tmp.

Adding the openshift.io/required-scc annotation ensures restricted-v2 is always assigned regardless of other SCCs' priority or restrictiveness, as required by the custom SCC preemption prevention enhancement:
https://github.com/openshift/enhancements/blob/master/enhancements/authentication/custom-scc-preemption-prevention.md

Summary by CodeRabbit

  • Bug Fixes

  • Pod creation operations in node image utilities now include proper OpenShift security constraint annotations, ensuring pods are created with appropriate cluster security policies.

  • Tests

  • Added test coverage to validate that security constraint annotations are correctly applied during pod creation and monitoring operations.

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.

@rwsu
Copy link
Copy Markdown
Contributor

rwsu commented May 6, 2026

/cherry-pick release-4.22

@openshift-cherrypick-robot
Copy link
Copy Markdown

@rwsu: new pull request created: #2266

Details

In response to this:

/cherry-pick release-4.22

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-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in release 5.0.0-0.nightly-2026-05-06-052707

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants