2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Add DHCP bringup to confluent= el8diskless

For routed, if user specifies confluent=, use that as a clue to
initiate a dhcp transaction to
facilitate routed requests.
This commit is contained in:
Jarrod Johnson 2022-11-30 11:09:39 -05:00
parent 2e20341ea0
commit c0f669cbdf

View File

@ -25,6 +25,7 @@ get_remote_apikey() {
fi
done
}
. /lib/dracut-lib.sh
root=1
rootok=1
netroot=confluent
@ -94,6 +95,36 @@ cd - > /dev/null
rm -rf $tpmdir
touch /etc/confluent/confluent.info
cd /sys/class/net
touch /etc/confluent/confluent.info
confluentsrv=$(getarg confluent)
DIDDHCP=0
if [ ! -z "$confluentsrv" ]; then
for i in *; do
ip link set $i up
done
if [[ "$confluentsrv" = *":"* ]]; then
confluenthttpsrv=[$confluentsrv]
/usr/libexec/nm-initrd-generator ip=:dhcp6
else
confluenthttpsrv=$confluentsrv
ifname=$(ip -br link|grep LOWER_UP|grep -v UNKNOWN|head -n 1|awk '{print $1}')
echo -n "Attempting to use dhcp to bring up $ifname..."
dhclient $ifname
echo -n "Complete: "
ip -br addr show dev $ifname
DIDDHCP=1
fi
myids=uuid=$(cat /sys/devices/virtual/dmi/id/product_uuid)
for mac in $(ip -br link|grep -v LOOPBACK|awk '{print $3}'); do
myids=$myids"/mac="$mac
done
myname=$(curl -sH "CONFLUENT_IDS: $myids" https://$confluenthttpsrv/confluent-api/self/whoami)
if [ ! -z "$myname" ]; then
echo NODENAME: $myname > /etc/confluent/confluent.info
echo MANAGER: $confluentsrv >> /etc/confluent/confluent.info
echo EXTMGRINFO: $confluentsrv'||1' >> /etc/confluent/confluent.info
fi
fi
echo -n "Scanning for network configuration..."
while ! grep ^EXTMGRINFO: /etc/confluent/confluent.info | awk -F'|' '{print $3}' | grep 1 >& /dev/null && [ "$TRIES" -lt 30 ]; do
TRIES=$((TRIES + 1))
@ -170,10 +201,12 @@ EOC
autoconfigmethod=$(grep ^ipv4_method: /etc/confluent/confluent.deploycfg |awk '{print $2}')
auto6configmethod=$(grep ^ipv6_method: /etc/confluent/confluent.deploycfg |awk '{print $2}')
if [ "$autoconfigmethod" = "dhcp" ]; then
echo -n "Attempting to use dhcp to bring up $ifname..."
dhclient $ifname
echo "Complete:"
ip addr show dev $ifname
if [ "$DIDDHCP" = "0" ]; then
echo -n "Attempting to use dhcp to bring up $ifname..."
dhclient $ifname
echo -n "Complete: "
ip -br addr show dev $ifname
fi
confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg| awk '{print $2}')
elif [ "$autoconfigmethod" = "static" ]; then
confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg| awk '{print $2}')