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

clone: Add dhcp and auto options for ipconfig #177

Merged
merged 1 commit into from
Apr 12, 2023
Merged

clone: Add dhcp and auto options for ipconfig #177

merged 1 commit into from
Apr 12, 2023

Conversation

sebastian-de
Copy link
Contributor

Contrary to the initial Cloud-Init networking PR (#142) DHCP has to be enabled explicitly.
Add and document the options to enable DHCP or SLAAC.

Tested on PVE 7.3.

DHCP doesn't get enabled automatically when no option is given.
Add and document the options to enable DHCP or SLAAC.
@sebastian-de sebastian-de requested a review from a team as a code owner March 13, 2023 14:38
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

The code looks good to me, I just left a question regarding how things work with those special values, but aside from that we should be good to go.

I'm pre-approving this PR, and will go back to it when my question's been addressed.

Thanks for the PR!

@@ -66,7 +66,7 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, []string, error) {
}
}
for _, i := range c.Ipconfigs {
if i.Ip != "" {
if i.Ip != "" && i.Ip != "dhcp" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, if we set it to dhcp, how is it forwarded to PVE? Same for IPv6 and SLAAC, how is it forwarded to PVE?
Also, if nothing is set, what's the behaviour for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the string matches dhcp (or auto for IPv6) it gets forwarded to PVE unchanged.

The PVE likewise just passes values matching auto or dhcp directly to the Cloud-Init network configuration.

The code of the PVE side is here: https://github.com/proxmox/qemu-server/blob/master/PVE/QemuServer/Cloudinit.pm#L186

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the above link, if ip or ip6 are not set, the resulting network configuration won't contain address entries.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me then, thanks for the explanation!

@lbajolet-hashicorp
Copy link
Contributor

Merging this PR, thanks again for the contribution @sebastian-de!

@lbajolet-hashicorp lbajolet-hashicorp merged commit 11eee96 into hashicorp:main Apr 12, 2023
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.

2 participants