-
Notifications
You must be signed in to change notification settings - Fork 410
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
Bug 1845885: templates: add node-valid-hostname.service for hostname check #1813
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: node-valid-hostname.service | ||
enabled: true | ||
contents: | | ||
[Unit] | ||
Description=Ensure hostname is not localhost | ||
# Only run when the host has a localhost name. | ||
ConditionHost=|localhost | ||
ConditionHost=|localhost.localdomain | ||
Before=network-online.target | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStartPre=/bin/echo "Node has localhost hostname. Waiting for new hostname." | ||
# Get the short hostname. This is more reliable than a regex. | ||
ExecStartPre=/bin/bash -c 'while [ `hostname -s` == "localhost" ]; do sleep 1; done;' | ||
ExecStart=/bin/sh -c "echo Node changed hostname to `hostname`" | ||
# Wait up to 5min for the node to get a real hostname. | ||
TimeoutSec=300 | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need this - if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The kublet is started after network-online.target. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I'm talking about removing the |
||
# Ensure that network-online.target will not complete until the node has a real hostname. | ||
RequiredBy=network-online.target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also write
TimeoutSec=5m
FWIW.