OSAC-4742: BCM label-based host selection - #738
Conversation
|
@mennyaboush: This pull request references OSAC-4742 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 story to target the "5.1.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. |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
4d38d24 to
86d9c5c
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mennyaboush The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
86d9c5c to
51b30da
Compare
Bring the BCM inventory backend to parity with the OpenStack/Metal3 label filtering from osac-project#404 (OSAC-3577/3578/3579), which skipped BCM. BCMClient.FindFreeHost now matches the BareMetalInstanceType host_label_selector as arbitrary key=value equality (AND across keys) instead of the legacy hostType/resource_class filter. BCM is the client-side twin of the OpenStack backend, so it mirrors OpenStack's control flow and permissive validation. Selector keys are matched directly against the device's extra_values -- BCM's native metadata bag, where resource_class already lives -- excluding OSAC-internal keys (osac_instance_id/osac_bmc_address/ osac_bmc_credentials_secret). managedBy is a default-aware ownership guard; provisionState is excluded (CRD-reserved, no BCM analog); assigned hosts skipped; invalid selectors rejected before any BCM API call. resource_class is no longer a required field/filter -- reported only. Matching extra_values directly (rather than a namespaced osac_labels map like OpenStack) keeps existing resource_class-only devices selectable with no migration, since nothing populates osac_labels and BCM's resource_class already lives in extra_values. Depends on osac-project#404 and must merge after it: the controller only passes the raw HostSelector (no hostType injection) once osac-project#404 lands. The BCM controller integration specs (createBCMBMI) are updated together with osac-project#404's version of that file when this branch is rebased onto post-osac-project#404 main. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: MENNY ABOUSH <maboush@maboush-thinkpadt14gen5.raanaii.csb>
51b30da to
f7dfb84
Compare
|
OSAC-4742: BCM Label Filtering
Story: [DEV] · Epic: OSAC-2857 Label-Based Host Selection · Design: OSAC-1201
Summary
Brings the BCM inventory backend to parity with the OpenStack/Metal3 label filtering added in #404 (which skipped BCM).
BCMClient.FindFreeHostnow matches theBareMetalInstanceTypehost_label_selectoras arbitrary key=value equality (AND across keys) instead of the legacy single-dimensionhostType/resource_classfilter.Approach
BCM is the client-side twin of the OpenStack backend, so it mirrors OpenStack's control flow and permissive validation (BCM labels are arbitrary
extra_valueskeys filtered client-side, not Kubernetes labels).Labels are matched against
extra_valuesdirectly (not a namespacedosac_labelsmap). Nothing populatesosac_labelsanywhere, and unlike Ironic (whereresource_classis a native field), BCM'sresource_classalready lives inextra_values— so matchingextra_valuesdirectly keeps existingresource_class-only devices selectable with zero migration, while supporting arbitrary multi-label selectors. OSAC-internal keys (osac_instance_id,osac_bmc_address,osac_bmc_credentials_secret) are excluded.managedBy: default-aware ownership guard (excluded from the generic match).provisionState: excluded (CRD-reserved; no BCM analog).osac_instance_idset) skipped; invalid selectors rejected before any BCM API call.resource_classis no longer required/filtered — reported only.Scope
Only
internal/inventory/bcm.go+internal/inventory/bcm_test.go. The controller and other backends are unchanged (they're in #404).Testing
go test ./internal/inventory/...passes, incl. new specs: arbitrary-label match, multi-label AND, OSAC-internal keys not matchable, per-devicemanagedByguard, and a validation table asserting no BCM query on invalid input.go build/go vet/gofmtclean.Open design point
Matching
extra_valuesdirectly is a conscious divergence from #404's OpenStackosac_labelsnamespacing (justified above). If anosac_labelspopulator is planned, we can switch to a namespaced map for cross-backend consistency — flagging for a quick decision.