OSAC-3210: reject Cluster creation when NetworkClass has no k8s_manager - #311
OSAC-3210: reject Cluster creation when NetworkClass has no k8s_manager#311ori-amizur wants to merge 1 commit into
Conversation
|
@ori-amizur: This pull request references OSAC-3210 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ori-amizur 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: osac-project/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesNetwork attachment validation
Estimated code review effort: 3 (Moderate) | ~25 minutes Mergeability Score: ⚪ Minimal · up to The PR adds localized Cluster-creation validation with accompanying tests; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant PrivateClustersServer
participant subnetDAO
participant virtualNetworkDAO
participant networkClassDAO
participant GenericServer
PrivateClustersServer->>subnetDAO: Resolve attached subnet
subnetDAO->>virtualNetworkDAO: Resolve virtual network
virtualNetworkDAO->>networkClassDAO: Resolve network class
networkClassDAO-->>PrivateClustersServer: Return network class managers
PrivateClustersServer->>GenericServer: Create cluster after validation
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 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 |
|
🤖 Review · Commit: |
|
🤖 Finished Review · ✅ Success · Started 10:50 AM UTC · Completed 11:05 AM UTC Commit: |
ReviewFindingsMedium
Low
Previous runReviewFindingsLow
|
Validate during Cluster creation that the network attachment's NetworkClass (resolved via Subnet → VirtualNetwork → NetworkClass) has a k8s_manager configured. Without k8s_manager, the hosting cluster has no MetalLB IPAddressPool and CaaS VIP allocation cannot function. Follows the BareMetalInstance pattern (OSAC-1464) which validates fabric_manager on the same chain. Dangling references are skipped — they fail independently during provisioning. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Ori Amizur <oamizur@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 12:18 PM UTC · Completed 12:35 PM UTC Commit: |
| if err != nil { | ||
| var notFoundErr *dao.ErrNotFound | ||
| if errors.As(err, ¬FoundErr) { | ||
| return nil |
There was a problem hiding this comment.
[medium] naming-convention
Log messages use lowercase verb (failed to query subnet for k8s_manager validation) while the established convention across all servers in this package is sentence-case (Failed to ...). The analogous function in private_baremetal_instances_server.go uses Failed to lookup subnet for fabric manager validation.
Suggested fix: Capitalise the log messages to match the codebase pattern.
| var notFoundErr *dao.ErrNotFound | ||
| if errors.As(err, ¬FoundErr) { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
[medium] naming-convention
Structured log keys use _key suffix (subnet_key, virtual_network_key, network_class_key) but the established convention across the servers package is _id suffix (subnet_id, virtual_network_id, network_class_id).
Suggested fix: Rename slog keys: subnet_key -> subnet_id, virtual_network_key -> virtual_network_id, network_class_key -> network_class_id.
Validate during Cluster creation that the network attachment's NetworkClass (resolved via Subnet → VirtualNetwork → NetworkClass) has a k8s_manager configured. Without k8s_manager, the hosting cluster has no MetalLB IPAddressPool and CaaS VIP allocation cannot function.
Follows the BareMetalInstance pattern (OSAC-1464) which validates fabric_manager on the same chain. Dangling references are skipped — they fail independently during provisioning.
Assisted-by: Claude Code noreply@anthropic.com
Summary by CodeRabbit
New Features
Bug Fixes