Skip to content
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

DHCP timeout is configurable #565

Merged
merged 3 commits into from
Jan 20, 2021
Merged

Conversation

tlwr
Copy link
Contributor

@tlwr tlwr commented Jan 11, 2021

What

Addresses #470, albeit quite naively. Building on the existing daemon configuration code

A user would deploy the daemon (using the systemd example):

[Service]
ExecStart=/opt/cni/bin/dhcp daemon -timeout 15s

to configure the DHCP client timeout to 15s. The default timeout remains 5s unchanged.

Why

If a user configures their DHCP daemon, because they are in an environment where DHCP responses may take a long time, an IP address will still be allocated for their container

Why not

It is arguable that a simpler solution would be to arbitrarily increase the default timeout to 15s. I can redo this PR to do that instead

Further work

If this is merged I will make a cni.dev PR to document the CLI option, consistent with hostprefix and friends

@tlwr tlwr changed the title Main DHCP timeout is configurable Jan 11, 2021
@tlwr tlwr changed the title DHCP timeout is configurable DHCP timeout is configurable [wip] Jan 11, 2021
Eventually the timeout value will become a CLI argument

The default timeout was nestled all the way in the lease constructor

This commit is the first step in making the timeout configurable by
moving it to the DHCPLease constructor

Signed-off-by: toby lorne <[email protected]>
@tlwr tlwr changed the title DHCP timeout is configurable [wip] DHCP timeout is configurable Jan 11, 2021
Copy link
Member

@mars1024 mars1024 left a comment

Choose a reason for hiding this comment

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

basically LGTM

@mars1024
Copy link
Member

one nit: consider defaulting client timeout to 10s just as https://github.com/d2g/dhcp4client/blob/ef524ad9cb076fe235ecc3c55913ef8445fa35fa/client.go#L39

@tlwr
Copy link
Contributor Author

tlwr commented Jan 13, 2021

Thanks for your review, I've co-authored a commit which changes the default to 10s

tlwr added a commit to tlwr/cni.dev that referenced this pull request Jan 16, 2021
@dcbw
Copy link
Member

dcbw commented Jan 20, 2021

/lgtm

@squeed
Copy link
Member

squeed commented Jan 20, 2021

awesome, thanks!

@jellonek jellonek merged commit 8c66d68 into containernetworking:master Jan 20, 2021
@tlwr tlwr deleted the main branch January 20, 2021 16:48
tlwr added a commit to tlwr/cni.dev that referenced this pull request Feb 5, 2021
tlwr added a commit to tlwr/cni.dev that referenced this pull request Feb 5, 2021
Related to containernetworking/plugins#565

Added double spaces for formatting

Signed-off-by: tlwr <[email protected]>
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.

5 participants