mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-02 18:04:23 +08:00
Merge pull request #2029 from gravitl/feature_0.18.0_interactive_script
modifying script for pre-release
This commit is contained in:
commit
e9ffe882cd
1 changed files with 63 additions and 25 deletions
|
@ -1,5 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
# setup_netclient - installs netclient locally
|
||||
setup_netclient() {
|
||||
|
||||
# DEV_TEMP - Temporary instructions for testing
|
||||
# wget https://fileserver.netmaker.org/testing/netclient
|
||||
# chmod +x netclient
|
||||
# ./netclient install
|
||||
|
||||
# RELEASE_REPLACE - Use this once release is ready
|
||||
# if [ -f /etc/debian_version ]; then
|
||||
# curl -sL 'https://apt.netmaker.org/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/netclient.asc
|
||||
# curl -sL 'https://apt.netmaker.org/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/netclient.list
|
||||
# sudo apt update
|
||||
# sudo apt install netclient
|
||||
# elif [ -f /etc/centos-release ]; then
|
||||
# curl -sL 'https://rpm.netmaker.org/gpg.key' | sudo tee /tmp/gpg.key
|
||||
# curl -sL 'https://rpm.netmaker.org/netclient-repo' | sudo tee /etc/yum.repos.d/netclient.repo
|
||||
# sudo rpm --import /tmp/gpg.key
|
||||
# sudo dnf check-update
|
||||
# sudo dnf install netclient
|
||||
# elif [ -f /etc/fedora-release ]; then
|
||||
# curl -sL 'https://rpm.netmaker.org/gpg.key' | sudo tee /tmp/gpg.key
|
||||
# curl -sL 'https://rpm.netmaker.org/netclient-repo' | sudo tee /etc/yum.repos.d/netclient.repo
|
||||
# sudo rpm --import /tmp/gpg.key
|
||||
# sudo dnf check-update
|
||||
# sudo dnf install netclient
|
||||
# elif [ -f /etc/redhat-release ]; then
|
||||
# curl -sL 'https://rpm.netmaker.org/gpg.key' | sudo tee /tmp/gpg.key
|
||||
# curl -sL 'https://rpm.netmaker.org/netclient-repo' | sudo tee /etc/yum.repos.d/netclient.repo
|
||||
# sudo rpm --import /tmp/gpg.key
|
||||
# sudo dnf check-update(
|
||||
# sudo dnf install netclient
|
||||
# elif [ -f /etc/arch-release ]; then
|
||||
# yay -S netclient
|
||||
# else
|
||||
# echo "OS not supported for automatic install"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# if [ -z "${install_cmd}" ]; then
|
||||
# echo "OS unsupported for automatic dependency install"
|
||||
# exit 1
|
||||
# fi
|
||||
}
|
||||
|
||||
|
||||
cat << "EOF"
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -409,36 +455,28 @@ ACCESS_TOKEN=$(jq -r '.accessstring' <<< ${curlresponse})
|
|||
|
||||
wait_seconds 3
|
||||
|
||||
echo "Configuring netmaker server as ingress gateway"
|
||||
# echo "Installing Netclient"
|
||||
# setup_netclient
|
||||
|
||||
for i in 1 2 3 4 5 6
|
||||
do
|
||||
echo " waiting for server node to become available"
|
||||
wait_seconds 10
|
||||
curlresponse=$(curl -s -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/netmaker)
|
||||
SERVER_ID=$(jq -r '.[0].id' <<< ${curlresponse})
|
||||
echo " Server ID: $SERVER_ID"
|
||||
if [ $SERVER_ID == "null" ]; then
|
||||
SERVER_ID=""
|
||||
fi
|
||||
if [[ "$i" -ge "6" && -z "$SERVER_ID" ]]; then
|
||||
echo " Netmaker is having issues configuring itself, please investigate (docker logs netmaker)"
|
||||
echo " Exiting..."
|
||||
exit 1
|
||||
elif [ -z "$SERVER_ID" ]; then
|
||||
echo " server node not yet configured, retrying..."
|
||||
elif [[ ! -z "$SERVER_ID" ]]; then
|
||||
echo " server node is now availble, continuing"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# echo "Adding Netclient to Network"
|
||||
# netclient join -t $ACCESS_TOKEN
|
||||
|
||||
# # TODO - Get Host ID
|
||||
|
||||
|
||||
if [[ ! -z "$SERVER_ID" ]]; then
|
||||
curl -o /dev/null -s -X POST -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/netmaker/$SERVER_ID/createingress
|
||||
fi
|
||||
# echo "Setting Netclient as Default Host"
|
||||
# HOST_ID=$(grep 'id:' /etc/netclient/netclient.yml | awk '{print $2}')
|
||||
# echo $HOST_ID
|
||||
# # TODO - API call to make host default
|
||||
|
||||
# echo "Setting Netclient as Ingress Gateway"
|
||||
# if [[ ! -z "$SERVER_ID" ]]; then
|
||||
# curl -o /dev/null -s -X POST -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/netmaker/$HOST_ID/createingress
|
||||
# fi
|
||||
)}
|
||||
|
||||
|
||||
|
||||
set +e
|
||||
test_connection
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue