Repository navigation
feat(rbac): allow tenants to start/stop/restart their VMs - #2777
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR extends the tenant "use" RBAC permissions to allow users to invoke KubeVirt VM power control actions. A new policy rule grants ChangesVM Power Control RBAC Permissions
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Grant the subresources.kubevirt.io virtualmachines/start|stop|restart "update" verb in cozy:tenant:use:base so the dashboard VM power controls work for tenant users (aggregates into admin/super-admin). Without it the actions return 403 even for tenant admins. Co-Authored-By: Claude <[email protected]> Signed-off-by: Andrei Kvapil <[email protected]>
2e0c644 to
8e78add
Compare
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the RBAC configuration to enable power management capabilities for tenant users. By extending the base tenant role, it ensures that users can perform start, stop, and restart operations on their virtual machines, aligning these permissions with existing operational access like console and VNC. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds power controls (start, stop, and restart) for tenant-owned virtual machines to the cluster roles in cozystack-basics, preventing 403 errors on the dashboard. The review feedback notes that the PR title uses an invalid scope (rbac) and the PR description is missing the required release-note block, both of which violate the repository's commit and PR guidelines.
| verbs: | ||
| - get | ||
| - update | ||
| # Power controls (start/stop/restart) for VMs owned by the tenant. |
There was a problem hiding this comment.
According to the repository guidelines, the PR and its commits must adhere to specific formatting rules:
- Invalid Scope: The scope
rbacused in the PR title (feat(rbac): ...) is not a valid scope. It should be a package-specific scope likecozystack-basicsor one of the allowed system/apps/meta scopes. - Missing Release Note: The PR body is missing the required
release-noteblock.
Please update the PR title/commits and add the release-note block to the PR description.
References
- Each commit must follow Conventional Commits format with valid scopes, and the PR body must contain a release-note block. (link)
Summary
Grants tenant users permission to call the KubeVirt VM power-control subresources (
subresources.kubevirt.io→virtualmachines/{name}/start|stop|restart, verbupdate) by adding them to thecozy:tenant:use:baseClusterRole, which aggregates intotenant-use,tenant-admin, andtenant-super-admin.Without this, the dashboard VM power buttons return 403 even for tenant admins:
kubectl auth can-i update virtualmachines --subresource=startisnofor every tenant role today, whilevirtualmachineinstances/console|vnc|portforwardare already granted at the sameuselevel — so power control belongs there too.Companion PR
UI that consumes this permission (VM power controls + VNC fixes): cozystack/cozystack-ui#27
Test
helm templaterenderscozy:tenant:use:basewith the newvirtualmachines/start|stop|restartrule.kubectl auth can-i update virtualmachines --subresource=start|stop|restartflips fromnotoyesfor thetenant-*-use/admin/super-admingroups.Summary by CodeRabbit