-
Notifications
You must be signed in to change notification settings - Fork 52
CNV-71166: Fix network interface selection issues #3179
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
base: main
Are you sure you want to change the base?
CNV-71166: Fix network interface selection issues #3179
Conversation
|
@galkremer1: This pull request references CNV-71166 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 bug to target the "4.21.0" version, but no target version was set. In 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. |
WalkthroughNetwork interface modal components refactored to derive network state directly from VM properties, eliminating redundant props. New utilities extracted for network name parsing, NAD filtering, and option building. Network patching logic updated to explicitly handle type switching between pod and multus network configurations. Changes
Sequence Diagram(s)sequenceDiagram
participant Modal as NetworkInterfaceModal
participant Select as NetworkInterfaceNetworkSelect
participant Utils as utils (Network Parsing)
participant VM as VM State
Modal->>Select: nicName, vm, isEditing
Select->>Utils: getOriginalNetworkName(vm, nicName)
Utils-->>Select: originalNetworkNameToUse
Select->>Utils: parseNetworkName(currentNetworkName)
Utils-->>Select: ParsedNetworkName
Select->>Utils: parseNetworkName(originalNetworkNameToUse)
Utils-->>Select: originalNetworkNameParsed
Select->>Utils: filterNADs(nads, vm, isEditing, ...)
Utils->>Utils: Check usage, apply edit-aware filtering
Utils-->>Select: filteredNADs
Select->>Utils: buildNetworkOptions(params)
Utils->>Utils: createNadOption(), createPodNetworkOption(), etc.
Utils-->>Select: networkOptions[]
Select->>Utils: getInterfaceTypeFromValue(selectedValue, options)
Utils-->>Select: interfaceType
Note over Modal,Utils: On submit with updated interface
Modal->>VM: Apply patch with cleaned interface properties
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
@galkremer1: This pull request references CNV-71166 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 bug to target the "4.21.0" version, but no target version was set. In 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. |
|
@galkremer1: This pull request references CNV-71166 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 bug to target the "4.21.0" version, but no target version was set. In 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. |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/utils/components/NetworkInterfaceModal/NetworkInterfaceModal.tsx(4 hunks)src/utils/components/NetworkInterfaceModal/components/NetworkInterfaceNetworkSelect/NetworkInterfaceNetworkSelect.tsx(6 hunks)src/utils/components/NetworkInterfaceModal/components/NetworkInterfaceNetworkSelect/utils.tsx(3 hunks)src/utils/resources/vm/utils/network/patch.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
src/utils/resources/vm/utils/network/patch.ts (1)
src/utils/resources/vm/utils/constants.ts (3)
BRIDGE(37-37)MASQUERADE(38-38)SRIOV(39-39)
src/utils/components/NetworkInterfaceModal/components/NetworkInterfaceNetworkSelect/NetworkInterfaceNetworkSelect.tsx (2)
src/utils/components/NetworkInterfaceModal/components/NetworkInterfaceNetworkSelect/utils.tsx (5)
getOriginalNetworkName(58-62)parseNetworkName(34-50)filterNADs(149-174)buildNetworkOptions(278-311)getInterfaceTypeFromValue(320-328)src/utils/components/NetworkInterfaceModal/utils/helpers.tsx (2)
podNetworkExists(34-35)isPodNetworkName(37-37)
src/utils/components/NetworkInterfaceModal/components/NetworkInterfaceNetworkSelect/utils.tsx (5)
src/utils/resources/vm/utils/selectors.ts (1)
getNetworks(33-33)src/utils/components/NetworkInterfaceModal/utils/helpers.tsx (3)
getNetworkName(39-44)getNadType(103-112)isPodNetworkName(37-37)src/utils/components/NetworkInterfaceModal/components/hooks/types.ts (1)
NetworkAttachmentDefinition(13-15)src/utils/components/NetworkInterfaceModal/components/NetworkInterfaceNetworkSelect/NetworkInterfaceNetworkSelect.tsx (1)
NetworkSelectTypeaheadOptionProps(48-50)src/utils/resources/vm/utils/constants.ts (1)
POD_NETWORK(41-41)
src/utils/components/NetworkInterfaceModal/NetworkInterfaceModal.tsx (1)
src/views/virtualmachines/details/tabs/configuration/network/utils/utils.ts (2)
getConfigInterfaceStateFromVM(96-104)isLinkStateEditable(145-146)
⏰ 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). (3)
- GitHub Check: build
- GitHub Check: unit-test
- GitHub Check: i18n
...orkInterfaceModal/components/NetworkInterfaceNetworkSelect/NetworkInterfaceNetworkSelect.tsx
Show resolved
Hide resolved
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: galkremer1, upalatucci The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold |
rszwajko
left a 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.
Converting primary network to secondary network looks risky to me. I'd rather block or limit the edit capability. Technically the primary network might be defined in various ways and is much different from secondary network.
| } | ||
|
|
||
| if (isCurrentPod && isNextMultus) { | ||
| // Switching from pod to multus - remove pod property |
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.
The code here makes too many assumptions about the pod network type.
The cases that I'm concerned:
- auto-attached pod network (
autoattachPodInterface) - here we have no network definition - multus as primary network
It would be also nice to check UDN based primary network.
📝 Description
pod networkingto anNADnetwork and vice versaJira Ticket: CNV-71166
🎥 Demo
Before:
Before.mov
After:
After.mov
Summary by CodeRabbit
Bug Fixes
Refactor