mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 01:46:58 +02:00
fix(dev-db/etcd): Require c10n, start even if cluster config is missing.
If c10n fails etcd should not start, wait until it is known if there is a cluster config to use or not. Also now c10n may not write out a cluster config on ec2 if there isn't a need for one. Make this case non-fatal and start up etcd as a master node.
This commit is contained in:
parent
8f6f6007a0
commit
0655858328
@ -18,7 +18,11 @@ BOOTSTRAP_PEERS="/var/run/etcd/bootstrap.config"
|
||||
BOOTSTRAP_DISCO="/var/run/etcd/bootstrap.disco"
|
||||
|
||||
META_URL="http://169.254.169.254/latest"
|
||||
MY_IP=$(curl -s $META_URL/meta-data/local-ipv4)
|
||||
MY_IP=$(curl --fail -s $META_URL/meta-data/local-ipv4)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Request to meta-data service failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARGS="${ARGS} -name ${MY_IP} -addr ${MY_IP}:4001 -peer-addr ${MY_IP}:7001 -peer-bind-addr 0.0.0.0"
|
||||
|
||||
@ -31,9 +35,6 @@ elif [ -e $BOOTSTRAP_PEERS ]; then
|
||||
if [ -n "$IPS" ]; then
|
||||
ARGS="${ARGS} -C ${IPS}"
|
||||
fi
|
||||
else
|
||||
echo "Could not find any bootstrap configuration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec /usr/bin/etcd $ARGS
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=etcd
|
||||
Wants=coreos-c10n.service
|
||||
Requires=coreos-c10n.service
|
||||
After=coreos-c10n.service
|
||||
|
||||
[Service]
|
||||
|
Loading…
Reference in New Issue
Block a user