Skip to content

SANDBOX-1067 | feature: namespace deletion member service account#1250

Merged
MikelAlejoBR merged 4 commits intocodeready-toolchain:masterfrom
MikelAlejoBR:SANDBOX-1067-workspace-reset-mo
Mar 16, 2026
Merged

SANDBOX-1067 | feature: namespace deletion member service account#1250
MikelAlejoBR merged 4 commits intocodeready-toolchain:masterfrom
MikelAlejoBR:SANDBOX-1067-workspace-reset-mo

Conversation

@MikelAlejoBR
Copy link
Copy Markdown
Contributor

@MikelAlejoBR MikelAlejoBR commented Jan 29, 2026

The registration service uses the member service account to be able to
interact with the member clusters. In order to be able to delete the
user namespaces to trigger a reconciliation from the NSTemplateSet
controller, we need the service account to have the "delete" permission
too.

Jira ticket

[SANDBOX-1067]

Summary by CodeRabbit

  • Tests
    • Expanded test coverage to include deletion permission checks for namespaces in addition to get/list/watch, improving verification of resource permission handling and reducing regressions in permission-sensitive flows.

@openshift-ci openshift-ci Bot requested review from fbm3307 and xcoulon January 29, 2026 18:45
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 29, 2026

Walkthrough

The change updates WaitForToolchainClusterResources to expand the namespaces resource verbs from ["get", "list", "watch"] to ["delete", "get", "list", "watch"].

Changes

Cohort / File(s) Summary
Test Support Configuration
testsupport/wait/member.go
Added the delete verb to the namespaces resource verbs in WaitForToolchainClusterResources; no other logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I hopped through code with nimble feet,
A single verb added, tidy and neat,
delete joins get, list, watch in line,
Small change, small dance, all tests will shine,
Thump-thump — a rabbit's celebratory beat!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main change: adding namespace deletion capability to the member service account, which aligns with the changeset that extends namespaces resource Verbs to include 'delete'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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
📝 Coding Plan for PR comments
  • Generate coding plan

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.

@MikelAlejoBR MikelAlejoBR reopened this Jan 29, 2026
@MikelAlejoBR MikelAlejoBR force-pushed the SANDBOX-1067-workspace-reset-mo branch from a323513 to 164c2a4 Compare January 29, 2026 19:00
@MikelAlejoBR
Copy link
Copy Markdown
Contributor Author

/retest

The registration service uses the member service account to be able to
interact with the member clusters. In order to be able to delete the
user namespaces to trigger a reconciliation from the NSTemplateSet
controller, we need the service account to have the "delete" permission
too.

SANDBOX-1067
@MikelAlejoBR MikelAlejoBR force-pushed the SANDBOX-1067-workspace-reset-mo branch from 164c2a4 to 8947756 Compare January 30, 2026 12:56
@MikelAlejoBR MikelAlejoBR reopened this Jan 30, 2026
Copy link
Copy Markdown
Contributor

@rsoaresd rsoaresd left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Copy Markdown
Contributor

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

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

Looks good!

Are you planning to add e2e tests in another PR and pair it with codeready-toolchain/registration-service#573 ?

@MikelAlejoBR
Copy link
Copy Markdown
Contributor Author

Looks good!

Are you planning to add e2e tests in another PR and pair it with codeready-toolchain/registration-service#573 ?

Yes, that was the idea!

@fbm3307
Copy link
Copy Markdown
Contributor

fbm3307 commented Feb 19, 2026

/retest

FYI- here if the paired member operator PR is not have the latest changes , the e2e and publish component e2e test fails i have updated the paired member operator PR with latest master changes.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fbm3307, mfrancisc, MikelAlejoBR, rsoaresd

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:
  • OWNERS [fbm3307,mfrancisc,rsoaresd]

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

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@testsupport/wait/member.go`:
- Around line 2658-2660: The ClusterRole binding grants cluster-wide namespace
deletion by listing "namespaces" in the Resources slice with the "delete" verb
for the toolchaincluster-member service account; remove the "delete" verb from
that Resources entry (or drop "namespaces" entirely) and instead implement a
separate, narrower ClusterRole/ServiceAccount reserved for namespace deletion
that validates ownership before deleting (create a dedicated controller and role
for that capability rather than allowing toolchaincluster-member to delete
cluster-scoped "namespaces").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee2e8349-fc85-4056-b4a0-9f6259095545

📥 Commits

Reviewing files that changed from the base of the PR and between 8947756 and 4eb58e5.

📒 Files selected for processing (1)
  • testsupport/wait/member.go

Comment on lines 2658 to +2660
APIGroups: []string{""},
Resources: []string{"namespaces"},
Verbs: []string{"get", "list", "watch"},
Verbs: []string{"delete", "get", "list", "watch"},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid granting cluster-wide namespace deletion to the shared member service account.

namespaces is cluster-scoped, so adding delete here lets toolchaincluster-member delete any namespace on the member cluster, not just user namespaces. That is a much larger blast radius than the PR objective describes. Prefer a narrower trigger path, or isolate this capability behind a dedicated controller/service account that validates ownership before deleting.

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

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

In `@testsupport/wait/member.go` around lines 2658 - 2660, The ClusterRole binding
grants cluster-wide namespace deletion by listing "namespaces" in the Resources
slice with the "delete" verb for the toolchaincluster-member service account;
remove the "delete" verb from that Resources entry (or drop "namespaces"
entirely) and instead implement a separate, narrower ClusterRole/ServiceAccount
reserved for namespace deletion that validates ownership before deleting (create
a dedicated controller and role for that capability rather than allowing
toolchaincluster-member to delete cluster-scoped "namespaces").

@sonarqubecloud
Copy link
Copy Markdown

@MikelAlejoBR
Copy link
Copy Markdown
Contributor Author

/retest

@mfrancisc
Copy link
Copy Markdown
Contributor

/retest

quay issue

@MikelAlejoBR MikelAlejoBR merged commit ea125f1 into codeready-toolchain:master Mar 16, 2026
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants