github.phpd.cn/cilium/cilium@v1.6.12/test/provision/compile.sh (about) 1 #!/bin/bash 2 set -e 3 4 CILIUM_DS_TAG="k8s-app=cilium" 5 KUBE_SYSTEM_NAMESPACE="kube-system" 6 KUBECTL="/usr/bin/kubectl" 7 PROVISIONSRC="/tmp/provision" 8 GOPATH="/home/vagrant/go" 9 10 DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 11 12 source "${PROVISIONSRC}/helpers.bash" 13 14 cd ${GOPATH}/src/github.com/cilium/cilium 15 16 if echo $(hostname) | grep "k8s" -q; 17 then 18 if [[ "$(hostname)" == "k8s1" ]]; then 19 echo "building cilium/cilium container image..." 20 make LOCKDEBUG=1 docker-image-no-clean 21 make LOCKDEBUG=1 docker-operator-image& 22 export OPERATORPID=$! 23 echo "pushing container image to k8s1:5000/cilium/cilium-dev..." 24 docker tag cilium/cilium k8s1:5000/cilium/cilium-dev 25 docker rmi cilium/cilium:latest 26 docker push k8s1:5000/cilium/cilium-dev 27 28 wait $OPERATORPID 29 docker tag cilium/operator k8s1:5000/cilium/operator 30 docker push k8s1:5000/cilium/operator 31 echo "Executing: $KUBECTL delete pods -n $KUBE_SYSTEM_NAMESPACE -l $CILIUM_DS_TAG" 32 $KUBECTL delete pods -n $KUBE_SYSTEM_NAMESPACE -l $CILIUM_DS_TAG 33 else 34 echo "Not on master K8S node; no need to compile Cilium container" 35 fi 36 else 37 echo "compiling cilium..." 38 sudo -u vagrant -H -E make LOCKDEBUG=1 SKIP_DOCS=true 39 echo "installing cilium..." 40 make install 41 mkdir -p /etc/sysconfig/ 42 cp -f contrib/systemd/cilium /etc/sysconfig/cilium 43 for svc in $(ls -1 ./contrib/systemd/*.*); do 44 cp -f "${svc}" /etc/systemd/system/ 45 service=$(echo "$svc" | sed -E -n 's/.*\/(.*?).(service|mount)/\1.\2/p') 46 echo "service $service" 47 systemctl enable $service || echo "service $service failed" 48 systemctl restart $service || echo "service $service failed to restart" 49 done 50 echo "running \"sudo adduser vagrant cilium\" " 51 sudo adduser vagrant cilium 52 fi