fix(cluster): fail closed on unresolved TEE runtimes - #425
Conversation
WalkthroughThe change adds TEE validation, improves managed-node platform detection, moves detection after operator readiness, and resolves runtime classes before confidential-compute inventory allocation in both inventory implementations. ChangesTEE validation and confidential workload scheduling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Reservation
participant Inventory
participant RuntimeClassForTEEType
participant WorkloadAllocation
Reservation->>Inventory: submit TEE request
Inventory->>RuntimeClassForTEEType: resolve TEE type and platform
RuntimeClassForTEEType-->>Inventory: return RuntimeClass or error
Inventory->>WorkloadAllocation: pass resolved RuntimeClass
WorkloadAllocation-->>Inventory: adjust CPU or GPU inventory
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Reject unknown or conflicting TEE requests before inventory mutation, resolve the runtime class exhaustively, and detect platforms only from managed nodes after inventory discovery is ready. Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
bc2507b to
1801dff
Compare
There was a problem hiding this comment.
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 `@cluster/inventory.go`:
- Around line 150-157: Update the reservation restoration loop in
newInventoryService so an error from teeTypeFromClusterParams for one deployment
is logged and isolated to that reservation instead of being returned. Skip the
invalid reservation (excluding it from reservations) and continue restoring the
remaining deployments so go is.run(ctx, reservations) can start.
- Around line 514-544: Update teeTypeFromClusterParams to handle
crd.ReservationClusterSettings in its type switch, extracting its
SchedulerParams into sparams like the existing ClusterSettings cases. Preserve
the current parsing, invalid-type errors, and conflicting-type detection for
restored reservation settings.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c0e83eea-58df-42bf-bdc6-6c56dc9f11b4
📒 Files selected for processing (11)
cluster/client.gocluster/inventory.gocluster/inventory_test.gocluster/kube/builder/runtime_class_test.gocluster/kube/builder/workload.gocluster/kube/client_attestation.gocluster/kube/client_attestation_test.gocluster/kube/operators/clients/inventory/inventory.gocluster/kube/operators/clients/inventory/tee_runtime_test.gocluster/types/v1beta3/clients/inventory/inventory.gocluster/types/v1beta3/clients/inventory/tee_runtime_test.go
Signed-off-by: Joseph Chalabi <chalabi.joseph@gmail.com>
Why
A confidential workload whose TEE type or node platform cannot be resolved must not fall through to the ordinary OCI runtime. Startup label races, unmanaged nodes, mixed TEE platforms, and unknown values could otherwise silently remove the confidentiality boundary.
What changed
Validation
CGO was disabled because the local Xcode/clang installation is broken. These focused tests passed:
All current GitHub checks pass; one non-applicable check is skipped.