Merge pull request #3173 from weaveworks/reclaim-tweaks
Rearrange peer reclaim checks in weave-kube launch script
This commit is contained in:
2 files changed
+10
-10
No files matched your search
@@ -79,7 +79,6 @@ func addMyselfToPeerList(cml *configMapAnnotations, c *kubernetes.Clientset, pee
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
common.Log.Infoln("[kube-peers] Added myself to peer list", list)
|
|
||||||
return list, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,10 +215,11 @@ func main() {
|
|||||||
if justReclaim {
|
if justReclaim {
|
||||||
cml := newConfigMapAnnotations(configMapNamespace, configMapName, c)
|
cml := newConfigMapAnnotations(configMapNamespace, configMapName, c)
|
||||||
|
|
||||||
_, err := addMyselfToPeerList(cml, c, peerName, nodeName)
|
list, err := addMyselfToPeerList(cml, c, peerName, nodeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
common.Log.Fatalf("[kube-peers] Could not update peer list: %v", err)
|
common.Log.Fatalf("[kube-peers] Could not update peer list: %v", err)
|
||||||
}
|
}
|
||||||
|
common.Log.Infoln("[kube-peers] Added myself to peer list", list)
|
||||||
|
|
||||||
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
|
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
|
||||||
err = reclaimRemovedPeers(weave, cml, peers, peerName)
|
err = reclaimRemovedPeers(weave, cml, peers, peerName)
|
||||||
|
|||||||
@@ -95,13 +95,12 @@ if [ -z "$PEERNAME" ]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if peer reclaim is in use - we don't want to delete persisted data on an upgrade
|
# If we have persisted data and peer reclaim is in use
|
||||||
if /usr/bin/weaveutil get-db-flag "$DB_PREFIX" peer-reclaim >/dev/null ; then
|
if [ -f ${DB_PREFIX}data.db ]; then
|
||||||
# If this peer name is not stored in the list, either we are a
|
if /usr/bin/weaveutil get-db-flag "$DB_PREFIX" peer-reclaim >/dev/null ; then
|
||||||
# brand-new peer or we were removed by another peer while temporarily
|
# If this peer name is not stored in the list then we were removed by another peer.
|
||||||
# absent. In order to avoid a CRDT clash for the latter case, clean up
|
if /home/weave/kube-peers -check-peer-new -peer-name="$PEERNAME" -log-level=debug ; then
|
||||||
if /home/weave/kube-peers -check-peer-new -peer-name="$PEERNAME" -log-level=debug ; then
|
# In order to avoid a CRDT clash, clean up
|
||||||
if [ -f ${DB_PREFIX}data.db ]; then
|
|
||||||
echo "Peer not in list; removing persisted data" >&2
|
echo "Peer not in list; removing persisted data" >&2
|
||||||
rm -f ${DB_PREFIX}data.db
|
rm -f ${DB_PREFIX}data.db
|
||||||
fi
|
fi
|
||||||
@@ -133,7 +132,8 @@ post_start_actions() {
|
|||||||
export HOST_ROOT
|
export HOST_ROOT
|
||||||
/home/weave/weave --local setup-cni
|
/home/weave/weave --local setup-cni
|
||||||
|
|
||||||
/home/weave/kube-peers -reclaim -node-name="$HOSTNAME" -peer-name="$PEERNAME" -log-level=debug
|
# Attempt to run the reclaim process, but don't halt the script if it fails
|
||||||
|
/home/weave/kube-peers -reclaim -node-name="$HOSTNAME" -peer-name="$PEERNAME" -log-level=debug || true
|
||||||
|
|
||||||
# Expose the weave network so host processes can communicate with pods
|
# Expose the weave network so host processes can communicate with pods
|
||||||
/home/weave/weave --local expose $WEAVE_EXPOSE_IP
|
/home/weave/weave --local expose $WEAVE_EXPOSE_IP
|
||||||
|
|||||||
Reference in new issue
Block a user