-
Notifications
You must be signed in to change notification settings - Fork 5
chore: add multi VPC attachment test #857
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: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds support for testing multi-VPC attachments in the testing framework. It enables servers to be attached to multiple VPCs simultaneously using a primary+next pattern for VPC selection.
Key changes:
- Added multi-VPC server selection logic that chooses servers by connection type (unbundled, bundled, mclag, eslag)
- Modified VPC attachment creation to support multiple attachments per server with proper naming
- Updated connectivity testing to test all attachment combinations between servers
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/hhfab/testing.go | Main implementation of multi-VPC attachment logic, modified VPC setup and connectivity testing |
| pkg/hhfab/hhnet.sh | Added addvlan command to support adding VLANs to existing bonds |
| cmd/hhfab/main.go | Added CLI flag --servers-with-multi-vpc to control the feature |
| // If wraparound results in same VPC (edge case with single VPC), skip to avoid duplicate | ||
| if currentVPCID == vpcID && totalVPCs > 1 { | ||
| currentVPCID = (vpcID + 2) % totalVPCs |
Copilot
AI
Aug 11, 2025
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 edge case handling for wraparound when currentVPCID equals vpcID could be simplified. Consider using a while loop to ensure we always get a different VPC ID rather than hardcoding the +2 offset.
| // If wraparound results in same VPC (edge case with single VPC), skip to avoid duplicate | |
| if currentVPCID == vpcID && totalVPCs > 1 { | |
| currentVPCID = (vpcID + 2) % totalVPCs | |
| // If wraparound results in same VPC, increment until different (avoids duplicate) | |
| for currentVPCID == vpcID && totalVPCs > 1 { | |
| currentVPCID = (currentVPCID + 1) % totalVPCs |
pkg/hhfab/testing.go
Outdated
| } | ||
| slog.Debug("Checking connectivity", logArgs...) | ||
|
|
||
| sourceInterface := fmt.Sprintf("bond0.%d", attachA.VLAN) |
Copilot
AI
Aug 11, 2025
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 interface name format "bond0.%d" is hardcoded in multiple places. Consider defining it as a constant to improve maintainability.
| sourceInterface := fmt.Sprintf("bond0.%d", attachA.VLAN) | |
| sourceInterface := fmt.Sprintf(BondInterfaceFormat, attachA.VLAN) |
pkg/hhfab/testing.go
Outdated
| cmd := fmt.Sprintf("toolbox -q timeout -v %d iperf3 -P 4 -J -c %s -t %d", opts.IPerfsSeconds+25, toIP.String(), opts.IPerfsSeconds) | ||
|
|
||
| if sourceInterface != "" { | ||
| cmd += fmt.Sprintf(" -B %s", sourceInterface) |
Copilot
AI
Aug 11, 2025
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 iperf3 -B flag expects an IP address or interface name, but sourceInterface contains a VLAN interface name (e.g., "bond0.1000"). This may not work correctly with iperf3. Consider using the IP address of the interface instead.
| cmd += fmt.Sprintf(" -B %s", sourceInterface) | |
| bindAddr := sourceInterface | |
| // If sourceInterface looks like an interface name (not an IP), resolve to IP | |
| if netip.ParseAddr(sourceInterface).IsValid() == false { | |
| ip, err := getInterfaceIP(sourceInterface) | |
| if err != nil { | |
| return fmt.Errorf("could not resolve IP for interface %q: %w", sourceInterface, err) | |
| } | |
| bindAddr = ip | |
| } | |
| cmd += fmt.Sprintf(" -B %s", bindAddr) |
pkg/hhfab/testing.go
Outdated
|
|
||
| slog.Debug("Checking external connectivity", "from", fmt.Sprintf("%s(%s/%s)", serverA, attach.VPC, attach.Subnet), "reachable", reachable) | ||
|
|
||
| sourceInterface := fmt.Sprintf("bond0.%d", attach.VLAN) |
Copilot
AI
Aug 11, 2025
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 interface name format "bond0.%d" is duplicated again. This reinforces the need for a constant to avoid inconsistencies.
| sourceInterface := fmt.Sprintf("bond0.%d", attach.VLAN) | |
| sourceInterface := fmt.Sprintf(BondInterfaceFormat, attach.VLAN) |
Signed-off-by: Pau Capdevila <[email protected]>
343ea61 to
54fba50
Compare
|
I think we shouldn't be doing it now, there are too many things to do:
|
No description provided.