Skip to content

Commit

Permalink
Re-use existing config file on meshnet restart
Browse files Browse the repository at this point in the history
  • Loading branch information
networkop committed Jul 8, 2019
1 parent c666405 commit 4518e7f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ if [ -d "/etc/cni/net.d/" ] && [ -f "./meshnet.conf" ]; then
cp ./meshnet.conf /etc/cni/net.d/
fi

echo "Mergin existing CNI configuration with meshnet"
existing=$(ls -1 /etc/cni/net.d/ | egrep "flannel|weave|bridge|calico|contiv|cilium|cni" | head -n1)
jq -s '.[1].delegate = (.[0].plugins[0])' /etc/cni/net.d/$existing /etc/cni/net.d/meshnet.conf | jq .[1] > /etc/cni/net.d/00-meshnet.conf
if [ ! -f /etc/cni/net.d/00-meshnet.conf ]; then
echo "Mergin existing CNI configuration with meshnet"
existing=$(ls -1 /etc/cni/net.d/ | egrep "flannel|weave|bridge|calico|contiv|cilium|cni" | head -n1)
jq -s '.[1].delegate = (.[0].plugins[0])' /etc/cni/net.d/$existing /etc/cni/net.d/meshnet.conf | jq .[1] > /etc/cni/net.d/00-meshnet.conf
else
echo "Re-using existing CNI config"
fi

echo "Starting meshnetd daemon"
/meshnetd

0 comments on commit 4518e7f

Please sign in to comment.