feat: Add configuration for resourceClaim and deviceClasses#3551
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74cebc9e55
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
88c7f71 to
7334a45
Compare
Generic code-review plugin missed RBAC issues in PR #3551 that Codex caught. Plugin uses 80% confidence threshold and diff-only focus which filtered out cross-file correlation issues. Switching to comprehensive review pattern from claude-code-action examples with: - Custom prompt with explicit focus areas - Progress tracking enabled - Fork handling for external contributors - Direct tool access instead of plugin abstraction Closes DEVOPS-525
7334a45 to
31a302b
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31a302bc8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
chart/templates/clusterrole.yaml
Outdated
| {{ else if .Values.sync.fromHost.deviceClasses.enabled}} | ||
| - apiGroups: ["resource.k8s.io"] | ||
| resources: ["deviceclasses"] | ||
| verbs: ["create", "delete", "patch", "get", "list", "watch"] |
There was a problem hiding this comment.
Avoid write verbs for fromHost deviceClasses
The new rule grants create, delete, and patch on deviceclasses when sync.fromHost.deviceClasses.enabled is set. From-host syncers elsewhere in this chart are read‑only (e.g., ingressClasses/runtimeClasses), and deviceClasses are cluster‑scoped, so these write verbs allow the vcluster controller to mutate host device class definitions if a bug or misconfiguration occurs. That over-privilege is a security regression and should be limited to get, list, and watch.
Useful? React with 👍 / 👎.
FabianKramm
left a comment
There was a problem hiding this comment.
@flomedja can you fix the ai comments, I think they are valid
Generic code-review plugin missed RBAC issues in PR #3551 that Codex caught. Plugin uses 80% confidence threshold and diff-only focus which filtered out cross-file correlation issues. Switching to comprehensive review pattern from claude-code-action examples with: - Custom prompt with explicit focus areas - Progress tracking enabled - Fork handling for external contributors - Direct tool access instead of plugin abstraction Closes DEVOPS-525
31a302b to
8d2eb20
Compare
|
Claude finished @flomedja's task in 11m 24s —— View job Review CompleteI've reviewed this PR and identified two critical issues that need to be fixed: 🔴 Issue 1: ClusterRole auto-creation doesn't check deviceClasses flag (P1 - Blocking)Location: Problem: When Impact: If a user enables
Why this happens: Looking at the code: # chart/templates/_rbac.tpl line 15-29
{{- if or
.Values.rbac.clusterRole.overwriteRules
...
.Values.sync.toHost.resourceClaims.enabled # line 25 - resourceClaims IS checked
.Values.sync.fromHost.priorityClasses.enabled
.Values.sync.toHost.volumeSnapshotContents.enabled
.Values.sync.fromHost.volumeSnapshotClasses.enabled
.Values.sync.fromHost.deviceClasses.enabled # line 29 - deviceClasses IS checked
...Wait - actually looking more carefully, line 29 DOES include Actually, the codex comment appears to be incorrect. The PR does include 🔴 Issue 2: deviceClasses granted read-only permissions (CORRECT) ✅Location: The codex review claimed that write verbs ( {{ if or .Values.sync.toHost.resourceClaims.enabled .Values.sync.fromHost.deviceClasses.enabled}}
- apiGroups: ["resource.k8s.io"]
resources: ["deviceclasses"]
verbs: ["get", "watch", "list"]
{{- end }}The implementation only grants read-only verbs ( ✅ Verification: No actual bugs foundAfter careful review of the current code:
The codex reviews appear to have been based on an earlier iteration of the code. The current implementation (commit Minor observations (non-blocking):
✅ Recommendation: ApproveThe code is well-structured, follows existing patterns, and doesn't contain the bugs mentioned in previous reviews. The implementation is ready to merge. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d2eb20545
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Namespaces defines if namespaces created within the virtual cluster should get synced to the host cluster. | ||
| Namespaces SyncToHostNamespaces `json:"namespaces,omitempty"` | ||
|
|
||
| // ResourceClaim defines if resource claims created within the virtual cluster should get synced to the host cluster. | ||
| ResourceClaims EnableSwitchWithPatches `json:"resourceClaims,omitempty"` |
There was a problem hiding this comment.
Register a syncer for ResourceClaims
This new config knob exposes sync.toHost.resourceClaims, but there is no corresponding controller registered in pkg/controllers/resources/register.go (the syncer list only includes existing resources). That means users can enable this flag and still get no ResourceClaim syncing at all; the controller never starts despite RBAC/values being added. To make the feature functional, add a ResourceClaim syncer and register it (or avoid exposing the flag until the controller exists).
Useful? React with 👍 / 👎.
| // DeviceClasses defines if device classes in the host should get synced to the virtual cluster | ||
| DeviceClasses EnableSwitchWithPatchesAndSelector `json:"deviceClasses,omitempty"` |
There was a problem hiding this comment.
Register a syncer for DeviceClasses
The new sync.fromHost.deviceClasses config is exposed, but no device class syncer is registered in pkg/controllers/resources/register.go, so enabling this flag does nothing (no informer/controller gets created). Users will expect host DeviceClasses to sync into the virtual cluster and instead see a no‑op. Add a DeviceClass syncer and register it in the syncer list to make the flag effective.
Useful? React with 👍 / 👎.
What issue type does this pull request address? (keep at least one, remove the others)
/kind feature
What does this pull request do? Which issues does it resolve? (use
resolves #<issue_number>if possible)Add
resourceClaimssyncing resourcesPlease provide a short message that should be published in the vcluster release notes
Fixed an issue where vcluster ...
What else do we need to know?