Merge pull request #180 from ibuildthecloud/pr165

Fixup pr165
This commit is contained in:
Darren Shepherd 2019-03-07 09:34:37 -07:00 committed by GitHub
commit 63b81d3399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -3,6 +3,8 @@ set -e
cd $(dirname $0)/..
. ./scripts/setup-rancher-path.sh
# Prime sudo
sudo echo Compiling
@ -15,4 +17,4 @@ else
fi
echo Starting agent
sudo env "PATH=$(pwd)/bin:$PATH" ./bin/k3s-agent --debug agent -s https://localhost:6443 -t $(<${HOME}/.rancher/k3s/server/node-token) "$@"
sudo env "PATH=$(pwd)/bin:$PATH" ./bin/k3s-agent --debug agent -s https://localhost:6443 -t $(<${RANCHER_PATH}/k3s/server/node-token) "$@"

View File

@ -1,6 +1,10 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
. ./scripts/setup-rancher-path.sh
IP=$(ip addr show dev docker0 | grep -w inet | awk '{print $2}' | cut -f1 -d/)
docker run \
--read-only \
@ -16,4 +20,4 @@ docker run \
-v /var/lib/cni \
-v /usr/lib/x86_64-linux-gnu/libsqlite3.so.0:/usr/lib/x86_64-linux-gnu/libsqlite3.so.0:ro \
--privileged \
ubuntu:18.04 /usr/bin/k3s-agent agent -t $(<~/.rancher/k3s/server/node-token) -s https://${IP}:6443
ubuntu:18.04 /usr/bin/k3s-agent agent -t $(<${RANCHER_PATH}/k3s/server/node-token) -s https://${IP}:6443

7
scripts/setup-rancher-path.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ $(id -u) = 0 ]; then
RANCHER_PATH="/var/lib/rancher"
else
RANCHER_PATH="$HOME/.rancher"
fi