Lightweight Kubernetes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

6 years ago
#!/bin/bash
set -e -x
ROOT_VERSION=v0.0.1
6 years ago
source $(dirname $0)/version
cd $(dirname $0)/..
curl --compressed -sfL https://github.com/ibuildthecloud/k3s-root/releases/download/${ROOT_VERSION}/k3s-root-${ARCH}.tar | tar xf -
rm -rf bin/kubectl bin/k3s-agent bin/k3s-server bin/kubectl bin/k3s build/data
ln -s containerd bin/k3s-agent
ln -s containerd bin/k3s-server
ln -s containerd bin/kubectl
for i in bridge flannel host-local loopback portmap; do
if [ -e ./bin/$i ]; then
rm -f ./bin/$i
fi
ln -s cni ./bin/$i
done
mkdir -p build/data
tar cvzf ./build/data.tar.gz --exclude ./bin/hyperkube ./bin
HASH=$(sha256sum ./build/data.tar.gz | awk '{print $1}')
cp ./build/data.tar.gz ./build/data/${HASH}.tgz
if [ ${ARCH} = amd64 ]; then
cp -f ./bin/hyperkube dist/hyperkube
CMD_NAME=dist/k3s
else
cp -f ./bin/hyperkube dist/hyperkube-${ARCH}
CMD_NAME=dist/k3s-${ARCH}
fi
6 years ago
go generate
LDFLAGS="-X github.com/rancher/k3s/version.Version=$VERSION -w -s"
STATIC="-extldflags '-static'"
CGO_ENABLED=0 go build -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go