mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 18:06:59 +02:00
Merge pull request #447 from polvi/etcd-refactor-more
use legacy hostnames in c10n
This commit is contained in:
commit
e338e6a354
@ -13,6 +13,7 @@ ETCD_SERVICE_D="/run/systemd/system/etcd.service.d"
|
|||||||
mkdir -p $ETCD_SERVICE_D
|
mkdir -p $ETCD_SERVICE_D
|
||||||
|
|
||||||
/usr/bin/block-until-url $META_URL
|
/usr/bin/block-until-url $META_URL
|
||||||
|
IP=$(curl -s $META_URL/meta-data/local-ipv4)
|
||||||
|
|
||||||
# Attempt to download userdata, exiting on failure or no user-data is found
|
# Attempt to download userdata, exiting on failure or no user-data is found
|
||||||
USER_DATA=$(curl -s --fail $META_URL/user-data)
|
USER_DATA=$(curl -s --fail $META_URL/user-data)
|
||||||
@ -85,7 +86,8 @@ fi
|
|||||||
if [ -n "${ETCD_DISCOVERY_URL}" ]; then
|
if [ -n "${ETCD_DISCOVERY_URL}" ]; then
|
||||||
echo "Using '${ETCD_DISCOVERY_URL}' as etcd discovery url"
|
echo "Using '${ETCD_DISCOVERY_URL}' as etcd discovery url"
|
||||||
echo "[Service]
|
echo "[Service]
|
||||||
Environment=ETCD_DISCOVERY=${ETCD_DISCOVERY}" > ${ETCD_SERVICE_D}/11-c10n.conf
|
Environment=ETCD_DISCOVERY=${ETCD_DISCOVERY}
|
||||||
|
Environment=ETCD_NAME=${IP}" > ${ETCD_SERVICE_D}/21-c10n.conf
|
||||||
# ...otherwise, we treat the provided user-data as a legacy c10n URL
|
# ...otherwise, we treat the provided user-data as a legacy c10n URL
|
||||||
elif [ -n "${C10N_TOKEN}" ]; then
|
elif [ -n "${C10N_TOKEN}" ]; then
|
||||||
depwarn "Bootstrapping etcd with the c10n service is deprecated."
|
depwarn "Bootstrapping etcd with the c10n service is deprecated."
|
||||||
@ -95,11 +97,11 @@ elif [ -n "${C10N_TOKEN}" ]; then
|
|||||||
# Assert we have networking up and able to access the c10n service
|
# Assert we have networking up and able to access the c10n service
|
||||||
/usr/bin/block-until-url $C10N_ENDPOINT
|
/usr/bin/block-until-url $C10N_ENDPOINT
|
||||||
|
|
||||||
IP=$(curl -s $META_URL/meta-data/local-ipv4)
|
|
||||||
ETCD_PEERS=$(curl -s $C10N_ENDPOINT -d "c10n_url=$C10N_TOKEN" -d"ip_list=$IP")
|
ETCD_PEERS=$(curl -s $C10N_ENDPOINT -d "c10n_url=$C10N_TOKEN" -d"ip_list=$IP")
|
||||||
echo "[Service]" > ${ETCD_SERVICE_D}/12-c10n.conf
|
echo "[Service]
|
||||||
|
Environment=ETCD_NAME=${IP}" > ${ETCD_SERVICE_D}/22-c10n.conf
|
||||||
for peer in $ETCD_PEERS; do
|
for peer in $ETCD_PEERS; do
|
||||||
echo "Environment=ETCD_PEERS=${peer}" >> ${ETCD_SERVICE_D}/12-c10n.conf
|
echo "Environment=ETCD_PEERS=${peer}" >> ${ETCD_SERVICE_D}/22-c10n.conf
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user