[incubator/etcd] Fix rejoin after failure (#9195)

Signed-off-by: Sergey Skripnick <sskripnick@mirantis.com>
This commit is contained in:
redixin
2019-01-07 21:18:12 -08:00
committed by Kubernetes Prow Robot
parent f635e8d41f
commit 4fe7143f82
2 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: etcd
home: https://github.com/coreos/etcd
version: 0.6.0
version: 0.6.1
appVersion: 2.2.5
description: Distributed reliable key-value store for the most critical data of a
distributed system.
+12 -10
View File
@@ -106,13 +106,23 @@ spec:
etcdctl member list | grep http://${HOSTNAME}.${SET_NAME}:2380 | cut -d':' -f1 | cut -d'[' -f1
}
# we should wait for other pods to be up before trying to join
# otherwise we got "no such host" errors when trying to resolve other members
for i in $(seq 0 $((${INITIAL_CLUSTER_SIZE} - 1))); do
while true; do
echo "Waiting for ${SET_NAME}-${i}.${SET_NAME} to come up"
ping -W 1 -c 1 ${SET_NAME}-${i}.${SET_NAME} > /dev/null && break
sleep 1s
done
done
# re-joining after failure?
if [ -e /var/run/etcd/default.etcd ]; then
echo "Re-joining etcd member"
member_id=$(cat /var/run/etcd/member_id)
# re-join member
ETCDCTL_ENDPOINT=$(eps) etcdctl member update ${member_id} http://${HOSTNAME}.${SET_NAME}:2380
ETCDCTL_ENDPOINT=$(eps) etcdctl member update ${member_id} http://${HOSTNAME}.${SET_NAME}:2380 | true
exec etcd --name ${HOSTNAME} \
--listen-peer-urls http://0.0.0.0:2380 \
--listen-client-urls http://0.0.0.0:2379\
@@ -160,14 +170,6 @@ spec:
--initial-cluster-state ${ETCD_INITIAL_CLUSTER_STATE}
fi
for i in $(seq 0 $((${INITIAL_CLUSTER_SIZE} - 1))); do
while true; do
echo "Waiting for ${SET_NAME}-${i}.${SET_NAME} to come up"
ping -W 1 -c 1 ${SET_NAME}-${i}.${SET_NAME} > /dev/null && break
sleep 1s
done
done
PEERS=""
for i in $(seq 0 $((${INITIAL_CLUSTER_SIZE} - 1))); do
PEERS="${PEERS}${PEERS:+,}${SET_NAME}-${i}=http://${SET_NAME}-${i}.${SET_NAME}:2380"
@@ -207,4 +209,4 @@ spec:
volumes:
- name: datadir
emptyDir: {}
{{- end }}
{{- end }}