8000 interface dhcp configuration by aojea · Pull Request #143 · google/dranet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

interface dhcp configuration #143

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

Merged
merged 1 commit into from
Jun 30, 2025
Merged

interface dhcp configuration #143

merged 1 commit into from
Jun 30, 2025

Conversation

aojea
Copy link
Collaborator
@aojea aojea commented Jun 28, 2025

dhcp should be an opt-in option because running it can cause delays on pod startup on environments that don't have dhcp enabled.

Change-Id: I2905788c261583d86a5701576c2e61a245138c02

dhcp should be an opt-in option because running it can cause delays
on pod startup on environments that don't have dhcp enabled.

Change-Id: I2905788c261583d86a5701576c2e61a245138c02
Copy link
@Copilot Copilot AI left a 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 makes DHCP configuration an opt‐in option to avoid startup delays in environments without DHCP enabled. It updates the network driver and DHCP client logic to conditionally request network parameters via DHCP, adjusts validations and tests to enforce mutually exclusive DHCP and manual addresses, and enhances documentation for the new DHCP field.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/driver/dra_hooks.go Adds conditional DHCP logic with a context-based timeout in the DHCP request and removes redundant DHCP code blocks.
pkg/driver/dhcp.go Updates the getDHCP function to accept a context and pass it to the DHCP request.
pkg/apis/validation_test.go Adds tests covering valid and invalid configurations involving the DHCP option.
pkg/apis/validation.go Updates validation to error when DHCP and addresses are both provided.
pkg/apis/types.go Documents and declares the new DHCP field in the InterfaceConfig type.
Comments suppressed due to low confidence (1)

pkg/driver/dhcp.go:48

  • [nitpick] Consider updating the error message format for consistency by using '%w' for error wrapping and reviewing the use of 'up' in the message to maintain uniformity with similar messages in the code.
		return "", nil, fmt.Errorf("fail to obtain DHCP lease on interface %s  up: %v", ifName, err)

// If there is no custom addresses then use the existing ones
if len(podCfg.Network.Interface.Addresses) == 0 {
// If DHCP is requested, do a DHCP request to gather the network parameters (IPs and Routes)
// ... but we DO NOT apply them in the root namespace
Copy link
Preview
Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a small inline comment or refactoring the conditional block to clarify that the DHCP configuration is opt-in and bypasses the default address acquisition to improve code readability in the future.

Suggested change
// ... but we DO NOT apply them in the root namespace
// ... but we DO NOT apply them in the root namespace
// Note: DHCP configuration is opt-in and bypasses the default address acquisition logic below.

Copilot uses AI. Check for mistakes.

@aojea aojea merged commit a7eb5d2 into google:main Jun 30, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
30A1
0