Honor explicit DHCP for aliased networks#452
Open
s4heid wants to merge 1 commit into
Open
Conversation
An interface alias identifies which device a network belongs to when the CPI cannot provide a MAC address. It must not override the network's explicit use_dhcp setting. Azure assigns control-plane static addresses through DHCP in the guest. For networks sharing a NIC, the CPI therefore supplies the same interface alias with use_dhcp set to true for both IPv4 and IPv6. The agent previously treated every aliased network as static. Each address family was consequently written separately to the same networkd file, and the last write discarded the other family. Honor explicit DHCP for aliased networks so both address families are grouped into one DHCP-enabled networkd unit. Preserve existing static alias behavior when use_dhcp is false.
Contributor
WalkthroughUpdated DHCP selection to recognize explicitly enabled DHCP networks even when an alias is present. Added coverage for IPv4 and IPv6 DHCP networks sharing an alias, including interface configuration creation and combined systemd-networkd output with IPv6, router acceptance, and DNS settings. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@platform/net/interface_configuration_creator.go`:
- Around line 224-225: Update the DHCP/static branch condition in the network
interface configuration creator so DHCP networks with a non-empty Alias and no
explicit use_dhcp remain on the dynamic DHCP path. Do not require UseDHCP for
the implicit DHCP case; preserve the existing static path for genuinely static
configurations.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4307a2fe-7fc8-4775-b3f4-7431f972ec33
📒 Files selected for processing (3)
platform/net/interface_configuration_creator.goplatform/net/interface_configuration_creator_test.goplatform/net/ubuntu_net_manager_ipv6_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this change about?
Honor explicit DHCP for aliased networks so both address families are grouped into one DHCP-enabled networkd unit. Preserve existing static alias behavior when
use_dhcpis false.Please provide contextual information.
An interface alias identifies which device a network belongs to when the CPI cannot provide a MAC address. It must not override the network's explicit use_dhcp setting.
Azure assigns control-plane static addresses through DHCP in the guest. For networks sharing a NIC, the CPI therefore supplies the same interface alias with use_dhcp set to true for both IPv4 and IPv6.
The agent previously treated every aliased network as static. Each address family was consequently written separately to the same networkd file, and the last write discarded the other family.
What tests have you run against this PR?
How should this change be described in bosh-agent release notes?
Something brief that conveys the change and is written with the Operator audience in mind.
See previous release notes for examples.
Does this PR introduce a breaking change?
No
Tag your pair, your PM, and/or team!
@a-hassanin
AI Review Feedback
All AI review comments (CodeRabbit, and Copilot when assigned) must be resolved before human reviewers will look at the PR. For each comment, either: