-
Notifications
You must be signed in to change notification settings - Fork 10
Add architecture hints to ephemeral volumes #1435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughController and tests updated to infer a machine's architecture from its MachineClass label and propagate that architecture into newly created ephemeral Volume OSImage.Architecture. A new constant defines the MachineArchitectureLabel key; tests and test helpers adjusted to exercise the behavior. Changes
Sequence DiagramsequenceDiagram
participant Reconciler as MachineEphemeralVolume Reconciler
participant Machine as Machine (object)
participant MachineClass as MachineClass (labels)
participant Volume as Volume (creation)
Reconciler->>Machine: Read Machine being reconciled
activate Machine
Reconciler->>MachineClass: Fetch referenced MachineClass
activate MachineClass
MachineClass-->>Reconciler: Return labels (may include architecture)
deactivate MachineClass
note right of Reconciler: Extract architecture via getMachineArchitecture()
loop for each ephemeral volume to create
Reconciler->>Volume: addArchitectureIfNeeded(volume, architecture)
alt architecture present and OSImage exists and not set
Volume-->>Reconciler: OSImage.Architecture set
else already present or no architecture
Volume-->>Reconciler: no change
end
Reconciler->>Volume: create Volume resource
Volume-->>Reconciler: creation result
end
deactivate Machine
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
api/common/v1alpha1/common_types.go(1 hunks)internal/controllers/compute/machine_ephemeralvolume_controller.go(4 hunks)internal/controllers/compute/machine_ephemeralvolume_controller_test.go(2 hunks)internal/controllers/compute/suite_test.go(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
internal/controllers/compute/suite_test.go (6)
api/common/v1alpha1/common_types.go (1)
MachineArchitectureLabel(36-36)internal/controllers/storage/suite_test.go (1)
SetupVolumeClass(189-201)internal/apis/storage/volumeclass_types.go (1)
VolumeClass(17-26)api/storage/v1alpha1/volumeclass_types.go (1)
VolumeClass(21-29)api/core/v1alpha1/resource.go (3)
ResourceList(74-74)ResourceIOPS(27-27)ResourceTPS(25-25)internal/apis/core/resource.go (3)
ResourceList(49-49)ResourceIOPS(24-24)ResourceTPS(22-22)
internal/controllers/compute/machine_ephemeralvolume_controller.go (1)
api/common/v1alpha1/common_types.go (1)
MachineArchitectureLabel(36-36)
internal/controllers/compute/machine_ephemeralvolume_controller_test.go (2)
utils/testing/testing.go (1)
SetupNamespace(148-156)internal/controllers/compute/suite_test.go (2)
SetupMachineClass(177-192)SetupVolumeClass(194-206)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (10)
internal/controllers/compute/suite_test.go (3)
13-14: LGTM!The import addition is necessary for using
MachineArchitectureLabelin the test setup.
182-184: LGTM!Adding the architecture label to the test MachineClass properly supports the new architecture-aware test scenarios.
194-206: LGTM!The
SetupVolumeClasshelper follows the existing pattern and correctly configures a VolumeClass with appropriate capabilities for testing.internal/controllers/compute/machine_ephemeralvolume_controller_test.go (3)
8-8: LGTM!The new imports are necessary for the architecture propagation test.
Also applies to: 16-16, 18-18
26-26: LGTM!Setting up the volume class for use in the architecture test.
97-147: LGTM!The test comprehensively validates that the controller properly propagates the architecture hint from the MachineClass to the ephemeral volume's OSImage data source. The test structure and assertions are well-designed.
internal/controllers/compute/machine_ephemeralvolume_controller.go (4)
13-13: LGTM!The new imports are necessary for the architecture propagation functionality.
Also applies to: 22-22, 25-25
135-147: LGTM!The
getMachineArchitecturemethod correctly fetches the MachineClass and returns the architecture label value. Returningnilwhen the label is not present is appropriate.
149-161: LGTM!The
addArchitectureIfNeededmethod correctly checks for OSImage presence and avoids overwriting an existing architecture value before setting the hint.
174-178: LGTM!Retrieving the machine architecture early in the reconcile loop is efficient and appropriate.
internal/controllers/compute/machine_ephemeralvolume_controller.go
Outdated
Show resolved
Hide resolved
3408391 to
fbf76c0
Compare
fbf76c0 to
d6195e7
Compare
Proposed Changes
Fixes #1434
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.