Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@anderbubble
Copy link
Collaborator

Description of the Pull Request (PR):

warewulf.conf has historically used .Ipaddr, .Network, and .Netmask settings to configure, primarily, the DHCP server. It is also used to configure the warewulf hostname in /etc/hosts on the server and cluster nodes.

Later development added support for specifying .Ipaddr as a CIDR-style value, e.g. 192.168.0.1/24. But this made the behavior of .Network and .Netmask unpredictable.

This PR simplifies the handling of all three fields. They remain strings for now; but if, during Parse(), .Ipaddr is found to be a CIDR-formatted value, the indicated network and netmask are written to the .Network and .Netmask configuration fields, and .Ipaddr is updated to be the bare address. (If either .Network or .Netmask is already specified, the specified value takes precedence.)

Similar updates have also been made to .Ipaddr6 and .Ipv6Net, though the behavior of .Ipaddr6 already required a CIDR address with no conversion, so this behavior has been retained.

Helper methods have been added--.IpCIDR() and .NetworkCIDR()--and their values are now presented to templates. (.NetworkCIDR was already present in the tstruct, but not populated.)

Finally, this PR removes a requirements that .Ipaddr6 represent a /64 or smaller subnet.

This fixes or addresses the following GitHub issues:

Reviewer checklist

The reviewer checks the following items before merging the PR.

  • The PR is based on the appropriate branch (typically main)
  • All commits are "Signed off" (e.g., using git commit --signoff) in agreement to the DCO
  • The CHANGELOG has been updated, if necessary, and under the correct release heading
  • The userdocs have been updated, if necessary
  • The submitter is listed in the contributors file
  • The test suite has been updated, if necessary

@anderbubble anderbubble added this to the v4.6.0 milestone Feb 4, 2025
@anderbubble anderbubble force-pushed the warewulf-conf-network branch 2 times, most recently from 1a7e3f3 to d6d7365 Compare February 4, 2025 20:53
@mslacken
Copy link
Member

mslacken commented Feb 5, 2025

Thanks for taking care of this mess and structuring it.
I still don't understand why you removed the feature, that without any configuration, we just the default network of the host?

@anderbubble
Copy link
Collaborator Author

I still don't understand why you removed the feature, that without any configuration, we just the default network of the host?

It's possible I was over-zealous here. I admit, I kinda just didn't like the way it worked, but that's not a good justification.

I'll re-visit and get back to you here with either a restoration or a justification.

@anderbubble anderbubble force-pushed the warewulf-conf-network branch from 333f591 to 6c9164c Compare February 6, 2025 00:22
@anderbubble
Copy link
Collaborator Author

@mslacken I've added server network auto-detection back in. I'm still mixed on it, as the auto-detection wouldn't make it to wwclient. (Right now, wwclient doesn't perform it; but, even if it did, it would detect itself as the server, not the actual Warewulf server.)

I think the only way around this would be to persist the configuration back out from its auto-detected state. I don't think we should write warewulf.conf on every invocation; but maybe we could track an internal boolean on WarewulfYaml that is flagged if auto-detection occurs, and then .Persist() during wwctl configure if that flag is activated?

I'll think about that some more, and maybe try to implement it later. But let me know if you have any thoughts about that.

@anderbubble anderbubble force-pushed the warewulf-conf-network branch from 6c9164c to c19bcce Compare February 6, 2025 01:08
@anderbubble
Copy link
Collaborator Author

persist the configuration back out from its auto-detected state

I went ahead and did this, basically as described above. I'm not 100% certain I like just doing it when wwctl configure is run, even without arguments; but I think it's probably alright.

Let me know what you think.

@JasonYangShadow
Copy link
Member

@anderbubble needing rebase

The previous method broke on ubuntu, where the value of ID was not quoted in
`/etc/os-release`. This broke tests that depended on paths set on known OSes.

Signed-off-by: Jonathon Anderson <[email protected]>
Signed-off-by: Jonathon Anderson <[email protected]>
@anderbubble anderbubble force-pushed the warewulf-conf-network branch from c19bcce to 112d5f3 Compare February 7, 2025 04:17
Copy link
Member

@JasonYangShadow JasonYangShadow left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to merge or ask for other members' reviews.

@anderbubble anderbubble force-pushed the warewulf-conf-network branch from 112d5f3 to 73f34d0 Compare February 7, 2025 04:29
@anderbubble
Copy link
Collaborator Author

@mslacken I'm going to go ahead and merge this, and plan to tag rc2 in the morning; but let me know if you have any concerns.

@anderbubble anderbubble merged commit 537358f into warewulf:main Feb 7, 2025
21 checks passed
@anderbubble anderbubble deleted the warewulf-conf-network branch February 7, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants