OSAC-1346: add public gRPC servers and server wiring for bare metal instances - #707
Conversation
|
Skipping CI for Draft Pull Request. |
|
@adriengentil: This pull request references OSAC-1346 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. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: osac-project/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (18)
WalkthroughThree new public gRPC servers ( ChangesPublic Bare Metal Instance API Surface
Sequence Diagram(s)sequenceDiagram
actor TenantAdmin
participant CLI
participant BareMetalInstancesServer
participant BareMetalInstanceCatalogItemsServer
participant PrivateDelegate
participant ReferenceChecker
rect rgba(255, 160, 0, 0.5)
Note over TenantAdmin,CLI: create baremetalinstance --catalog-item <id>
TenantAdmin->>CLI: run create command
CLI->>BareMetalInstancesServer: Create(BareMetalInstance spec)
BareMetalInstancesServer->>PrivateDelegate: Create(private object)
PrivateDelegate-->>BareMetalInstancesServer: created private object
BareMetalInstancesServer-->>CLI: instance ID
CLI-->>TenantAdmin: print instance ID
end
rect rgba(0, 120, 255, 0.5)
Note over TenantAdmin,BareMetalInstanceCatalogItemsServer: Get catalog item (published-state enforcement)
TenantAdmin->>BareMetalInstanceCatalogItemsServer: Get(catalog item id)
BareMetalInstanceCatalogItemsServer->>PrivateDelegate: Get(private id)
PrivateDelegate-->>BareMetalInstanceCatalogItemsServer: private object (unpublished)
BareMetalInstanceCatalogItemsServer->>ReferenceChecker: check reference exists
alt no reference
ReferenceChecker-->>BareMetalInstanceCatalogItemsServer: not found
BareMetalInstanceCatalogItemsServer-->>TenantAdmin: NotFound
else reference exists
BareMetalInstanceCatalogItemsServer-->>TenantAdmin: mapped public object
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 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 |
07376f2 to
90faf46
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
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 `@internal/cmd/cli/create/baremetalinstance/create_bare_metal_instance_cmd.go`:
- Line 74: Remove the //nolint:errcheck comment from the
MarkFlagRequired("catalog-item") call on line 74 in the
create_bare_metal_instance_cmd.go file and properly handle the error return.
Check if the error is not nil after calling MarkFlagRequired and return the
error to the caller or handle it appropriately, ensuring that failures to mark
the flag as required are not silently ignored and comply with the project's
error handling security guidelines.
- Around line 126-136: The run-strategy validation in the if block has a case
sensitivity mismatch: the code concatenates c.args.runStrategy directly with the
prefix "BARE_METAL_INSTANCE_RUN_STRATEGY_", but the actual enum keys use
uppercase (ALWAYS, HALTED). To fix this, convert c.args.runStrategy to uppercase
using strings.ToUpper before concatenating it with the prefix. Also add
"strings" to the imports at the top of the file so the strings package is
available.
🪄 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: b85bd749-53d6-41a6-80be-83c8b5ee02c2
📒 Files selected for processing (12)
charts/service/templates/grpc-server/authconfig.yamlinternal/cmd/cli/create/baremetalinstance/create_bare_metal_instance_cmd.gointernal/cmd/cli/create/create_cmd.gointernal/cmd/cli/describe/baremetalinstance/describe_baremetalinstance_cmd.gointernal/cmd/cli/describe/describe_cmd.gointernal/cmd/service/start/grpcserver/start_grpc_server_cmd.gointernal/servers/baremetal_instance_catalog_items_server.gointernal/servers/baremetal_instance_catalog_items_server_test.gointernal/servers/baremetal_instance_templates_server.gointernal/servers/baremetal_instance_templates_server_test.gointernal/servers/baremetal_instances_server.gointernal/servers/baremetal_instances_server_test.go
90faf46 to
542c2d7
Compare
4d5e76e to
8213980
Compare
…nstances Implements thin public wrappers over the private bare metal servers: - BareMetalInstanceTemplatesServer: List/Get only (read-only for tenants per EP; Create/Update/Delete remain Unimplemented) - BareMetalInstanceCatalogItemsServer: full CRUD with published filter on List, published+reference check on Get, and tenant scoping on Create handled transparently by the generic server - BareMetalInstancesServer: full CRUD with field-mask-aware Update Registers all three public servers in the main gRPC setup alongside the existing private servers. Unit tests included for all three servers. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Adrien Gentil <agentil@redhat.com>
Add BareMetalInstances (full CRUD), BareMetalInstanceTemplates (List/Get), and BareMetalInstanceCatalogItems (Get/List) to the has_client_permissions block. Add BareMetalInstanceCatalogItems (Create/Update/Delete) to the is_tenant_admin block so tenant admins can manage tenant-scoped catalog items. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Adrien Gentil <agentil@redhat.com>
Add `create baremetalinstance` with flags --catalog-item (required), --name, --ssh-key, --user-data, and --run-strategy (Always|Halted). Add `describe baremetalinstance` for looking up instances by ID or name, displaying ID, catalog item, and state. The generic `delete` command already supports bare metal instances via the reflection helper. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Adrien Gentil <agentil@redhat.com>
…sources
Add osac.{public,private}.v1.{BareMetalInstance,BareMetalInstanceCatalogItem,
BareMetalInstanceTemplate}.yaml table definitions so the CLI `get` command can
render these resources in tabular form.
Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Adrien Gentil <agentil@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Adrien Gentil <agentil@redhat.com>
ded9b4e to
0d0af6b
Compare
CLI output — bare metal resourcesPrivate API (
|
|
/cc @carbonin |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adriengentil, carbonin 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 |
|
/retest |
Summary
BareMetalInstanceTemplatesServer(List/Get only, per EP),BareMetalInstanceCatalogItemsServer(full CRUD with published-visibility enforcement and tenant scoping on Create), andBareMetalInstancesServer(full CRUD with field-mask-aware Update)Jira
https://redhat.atlassian.net/browse/OSAC-1346
Test plan
ginkgo run internal/servers— 979/979 passedgo build ./...— cleangofmt -s -w .— no drift🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Security