docs: add how to configure the correct etc hosts file with cloudinit CRD#1062
Open
Yu-Jack wants to merge 1 commit into
Open
docs: add how to configure the correct etc hosts file with cloudinit CRD#1062Yu-Jack wants to merge 1 commit into
Yu-Jack wants to merge 1 commit into
Conversation
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds documentation to help Harvester users correct /etc/hosts entries when using FQDN-based hostnames, using a CloudInit CRD to persist the change across reboots (per harvester/harvester#9496).
Changes:
- Document a CloudInit-based template that rewrites the default
127.0.0.1 localhost {hostname}entry and adds a{node IP} {FQDN} {short hostname}mapping. - Add guidance on CloudInit execution stages (
network.aftervs alternatives) and filename ordering behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| NODE_IP=$(ip addr show mgmt-br 2>/dev/null | awk '/inet /{print $2}' | cut -d/ -f1 | head -1) | ||
| [ -z "$NODE_IP" ] && exit 0 | ||
| sed -i 's/^127\.0\.0\.1.*/127.0.0.1 localhost/' /etc/hosts | ||
| grep -v "^[0-9a-f:.]\+[[:space:]]\+${FQDN}" /etc/hosts > /tmp/hosts.tmp && mv /tmp/hosts.tmp /etc/hosts |
|
|
||
| :::note | ||
|
|
||
| This template uses the `network.after` stage, which requires a reboot. If you have other custom CloudInit resources using the same stage, ensure they don't conflict. CloudInit files are executed in alphabetical order by filename. |
Signed-off-by: Jack Yu <jack.yu@suse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
harvester/harvester#9496