OSAC-1222: remove cores/memory_gib from ComputeInstance in favor of instance_type - #866
Conversation
|
@ygalblum: This pull request references OSAC-1222 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
WalkthroughThis PR removes legacy Changesinstance_type-only resource sizing migration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ComputeInstancesServer
participant SpecDefaultsUtil
participant Reconciler
participant InstanceTypesClient
Client->>ComputeInstancesServer: Create(ComputeInstance with instance_type)
ComputeInstancesServer->>SpecDefaultsUtil: ApplySpecDefaults / ValidateRequiredSpecFields
SpecDefaultsUtil-->>ComputeInstancesServer: instance_type required/defaulted
ComputeInstancesServer-->>Client: stored spec (instance_type only)
Reconciler->>Reconciler: addExplicitFields(ciSpec)
Reconciler->>InstanceTypesClient: Get(instance_type)
InstanceTypesClient-->>Reconciler: InstanceTypeSpec (cores, memory_gib)
Reconciler->>Reconciler: set spec.Cores, spec.MemoryGiB
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
✨ 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 |
…nstance_type Remove the deprecated cores and memory_gib fields from ComputeInstance and ComputeInstanceTemplate protos, replacing them with reserved directives. Update all server logic, CLI flags, reconciler, spec defaults, and tests to use instance_type as the sole compute specification method. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
73992af to
6be4a68
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@internal/controllers/computeinstance/computeinstance_reconciler_function.go`:
- Around line 632-651: The addExplicitFields path in task now hard-fails when
ComputeInstanceSpec has no instance_type, which will stall reconciliation for
legacy ComputeInstances. Add a migration or one-time backfill/legacy resolution
before the empty-instanceTypeName check in addExplicitFields so older records
can be populated or mapped to a default before resolving resources.
🪄 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: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: f9ce3558-e819-4340-94a5-a4490b0881f0
⛔ Files ignored due to path filters (8)
internal/api/osac/private/v1/compute_instance_template_type.pb.gois excluded by!**/*.pb.gointernal/api/osac/private/v1/compute_instance_template_type_protoopaque.pb.gois excluded by!**/*.pb.gointernal/api/osac/private/v1/compute_instance_type.pb.gois excluded by!**/*.pb.gointernal/api/osac/private/v1/compute_instance_type_protoopaque.pb.gois excluded by!**/*.pb.gointernal/api/osac/public/v1/compute_instance_template_type.pb.gois excluded by!**/*.pb.gointernal/api/osac/public/v1/compute_instance_template_type_protoopaque.pb.gois excluded by!**/*.pb.gointernal/api/osac/public/v1/compute_instance_type.pb.gois excluded by!**/*.pb.gointernal/api/osac/public/v1/compute_instance_type_protoopaque.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (18)
internal/cmd/cli/create/computeinstance/create_compute_instance_cmd.gointernal/controllers/computeinstance/computeinstance_reconciler_function.gointernal/controllers/computeinstance/computeinstance_reconciler_function_test.gointernal/servers/compute_instances_server.gointernal/servers/compute_instances_server_test.gointernal/servers/private_compute_instance_catalog_items_server.gointernal/servers/private_compute_instance_catalog_items_server_test.gointernal/servers/private_compute_instance_templates_server.gointernal/servers/private_compute_instance_templates_server_test.gointernal/servers/private_compute_instances_server.gointernal/servers/private_compute_instances_server_test.gointernal/utils/spec_defaults.gointernal/utils/spec_defaults_test.goit/it_compute_subnet_test.goproto/private/osac/private/v1/compute_instance_template_type.protoproto/private/osac/private/v1/compute_instance_type.protoproto/public/osac/public/v1/compute_instance_template_type.protoproto/public/osac/public/v1/compute_instance_type.proto
💤 Files with no reviewable changes (1)
- internal/servers/private_compute_instance_templates_server_test.go
| } | ||
| itSpec := response.GetObject().GetSpec() | ||
| spec.Cores = itSpec.GetCores() | ||
| spec.MemoryGiB = itSpec.GetMemoryGib() |
There was a problem hiding this comment.
Try to use spec.SetCores(...) , like you are using itSpec.GetCores(). We are currently using the hybrid API, but would like to move to the fully opaque API in the future, and this will not compile when we do that. I know this was already there.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhernand, ygalblum The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
PR osac-project#866 removed the Cores field from ComputeInstanceSpec but didn't update the test added by PR osac-project#783 in catalog_item_validation_test.go. Replace with RunStrategy to test the same unlisted-field rejection. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Dan Manor <dmanor@redhat.com>
Remove the deprecated cores and memory_gib fields from ComputeInstance and ComputeInstanceTemplate protos, replacing them with reserved directives. Update all server logic, CLI flags, reconciler, spec defaults, and tests to use instance_type as the sole compute specification method.
Assisted-by: Claude Code noreply@anthropic.com
Summary by CodeRabbit
New Features
Bug Fixes