-
Notifications
You must be signed in to change notification settings - Fork 110
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
dracut/hostname: shorten overlong hostname #509
Comments
This comment has been minimized.
This comment has been minimized.
For Kubernetes it's required that the hostname be routable. Which means that the "hostname shortening" logic must match whatever the cloud provider (GCP) will do. |
OK this came up again recently in openshift/machine-config-operator#2401 and here's my proposal: We ship That way the MCO doesn't need to carry bash code that shleps the hostname to a file, etc. |
It turned out this bit us badly in https://bugzilla.redhat.com/show_bug.cgi?id=2008521#c40 Clearly, we should have gone this route from the start. |
@lucab Did you have any further thoughts on this? It seems like we're all in agreement that afterburn should do this? |
Yes, I agree Afterburn should more strictly honor However I don't think this would resolve the BZ you linked, for two reasons:
So bottom line is that we should avoid bringing afterburn-hostname into more cases where DHCP is functional (e.g. GCP), it is only meant to handle those platforms where DHCP does not provide the hostname (e.g. Azure). |
Yes, but not in OpenShift today. The
Yes, I think everyone agrees with this. However, since it's afterburn that is writing a too-long
This is a good point. I really hope there aren't cases where we're hitting that today. In the BZ above, it's much more about having a better truncation strategy for the FQDN I think. |
On a subset of platforms, the
afterburn-hostname.service
tries to retrieve the node hostname from a metadata field and forward any value from there into/etc/hostname
as the machine static hostname.According to POSIX.1 "Host names (not including the terminating null byte) are limited to
HOST_NAME_MAX
bytes". On Linux,HOST_NAME_MAX
is defined with the value64
, see https://man7.org/linux/man-pages/man2/gethostname.2.html.From prior experiences, we know that it's possible that either humans or platforms try to set up names longer than than (e.g. FQDN up to 255 bytes), resulting in much pain.
Afterburn should have some additional logic in
write_hostname()
to truncate overlong hostnames to the first dot or toHOST_MAX_LEN
, whatever comes earlier.Note that this will possibly mean a desync between the hostname file and the metadata attributes files.
I wrote similar logic (with tests) for systemd-networkd once (systemd/systemd#7616) and it could be ported from there.
The text was updated successfully, but these errors were encountered: