-
Notifications
You must be signed in to change notification settings - Fork 1.5k
AGENT-501: Make it easier to change node zero IP and SERVICE_BASE_URL #6747
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
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
data/data/agent/files/etc/assisted/agent-installer.env.template
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # If NODE_ZERO_IP is changed, additional files need to be updated | ||
| # before starting up the agent-based installer services: | ||
| # | ||
| # In /usr/local/share/assisted-service/assisted-service.env, | ||
| # IMAGE_SERVICE_BASE_URL and SERVICE_BASE_URL must be updated. | ||
| # | ||
| # In /usr/local/share/assisted-service/images.env, | ||
| # ASSISTED_SERVICE_HOST must be updated. | ||
| # | ||
| NODE_ZERO_IP={{.NodeZeroIP}} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
|
|
||
| source /usr/local/share/assisted-service/assisted-service.env | ||
|
|
||
| wait_for_assisted_service() { | ||
| echo "Waiting for assisted-service to be ready" | ||
| until $(curl --output /dev/null --silent --fail ${SERVICE_BASE_URL}/api/assisted-install/v2/infra-envs); do | ||
| printf '.' | ||
| sleep 5 | ||
| done | ||
| } |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| source /etc/assisted/agent-installer.env | ||
| echo "NODE_ZERO_IP: $NODE_ZERO_IP" | ||
|
|
||
| timeout=$((SECONDS + 30)) | ||
|
|
||
| while [[ $SECONDS -lt $timeout ]] | ||
| do | ||
| IS_NODE_ZERO=$(ip -j address | jq "[.[].addr_info] | flatten | map(.local==\"$NODE_ZERO_IP\") | any") | ||
| if [ "${IS_NODE_ZERO}" = "true" ]; then | ||
| break | ||
| fi | ||
| sleep 5 | ||
| done | ||
|
|
||
| if [ "${IS_NODE_ZERO}" = "true" ]; then | ||
| echo "Node 0 IP ${NODE_ZERO_IP} found on this host" 1>&2 | ||
|
|
||
| NODE0_PATH=/etc/assisted/node0 | ||
| mkdir -p "$(dirname "${NODE0_PATH}")" | ||
|
|
||
| NODE_ZERO_MAC=$(ip -j address | jq -r ".[] | select(.addr_info | map(select(.local == \"$NODE_ZERO_IP\")) | any).address") | ||
| echo "MAC Address for Node 0: ${NODE_ZERO_MAC}" | ||
|
|
||
| cat >"${NODE0_PATH}" <<EOF | ||
| # This file exists if the agent-based installer has determined the host is node 0. | ||
| # The host is determined to be node 0 when one of its network interfaces has an | ||
| # IP address matching NODE_ZERO_IP in /etc/assisted/agent-installer.env. | ||
| # The MAC address of the network interface matching NODE_ZERO_IP is noted below | ||
| # as BOOTSTRAP_HOST_MAC. | ||
| # | ||
| # BOOTSTRAP_HOST_MAC is read by assisted-service. The host with a MAC address | ||
| # matching this value in assisted-service is designated to be the bootstrap during | ||
| # cluster installation. In assisted-service.service, this file is included as a | ||
| # --env-file in the ExecStart command. | ||
| # | ||
| # This file is also a ConditionPathExists in the following systemd service | ||
| # definitions: | ||
| # apply-host-config.service | ||
| # assisted-service-pod.service | ||
| # assisted-service.service | ||
| # create-cluster-and-infraenv.service | ||
| # install-status.service | ||
| # start-cluster-installation.service | ||
| BOOTSTRAP_HOST_MAC=${NODE_ZERO_MAC} | ||
| EOF | ||
|
|
||
| echo "Created file ${NODE0_PATH}" | ||
|
|
||
| rendezvousHostMessage="This host ${NODE_ZERO_IP} is the rendezvous host." | ||
|
|
||
| cat <<EOF >/etc/motd | ||
| The primary service is assisted-service.service. To watch its status, run: | ||
|
|
||
| journalctl -u assisted-service.service | ||
| EOF | ||
| else | ||
|
|
||
| rendezvousHostMessage="This host is not the rendezvous host. The rendezvous host is at ${NODE_ZERO_IP}." | ||
| fi | ||
| mkdir -p /etc/motd.d/ | ||
| echo $rendezvousHostMessage > /etc/motd.d/60-rendezvous-host | ||
| echo $rendezvousHostMessage > /etc/issue.d/60-rendezvous-host.issue | ||
| agetty --reload | ||
45 changes: 0 additions & 45 deletions
45
data/data/agent/files/usr/local/bin/set-node-zero.sh.template
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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.
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.
Nit - It doesn't look like there is a ConditionPathExists in assisted-service.service. Will need to either add it or change this comment.
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.
Other than that, looks good. I have not tested it yet but I will.
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.
Good catch.