Commit ab0bf777 authored by 杨文 陈's avatar 杨文 陈 Committed by Andy Postnikov
Browse files

testing/k3s: fix cni path, build server, add alternative bin

parent d7b02fa7
Pipeline #42601 passed with stages
in 14 minutes and 18 seconds
# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: wener <wenermail@gmail.com>
pkgname=k3s
_pkgver=1.18.8+k3s1
pkgver=${_pkgver/+k3s/.}
pkgrel=0
pkgrel=1
pkgdesc="Lightweight Kubernetes. 5 less than k8s."
url="https://k3s.io"
arch="all !mips !mips64"
license="Apache-2.0"
options="chmod-clean !check" # No test suite from upstream
depends="cni-plugins conntrack-tools containerd coreutils dbus findutils ipset iptables"
makedepends="go linux-headers"
makedepends="go linux-headers sqlite-dev sqlite-static zlib-dev zlib-static"
install="$pkgname.post-install $pkgname.pre-deinstall"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rancher/k3s/archive/v$_pkgver.tar.gz
k3s.confd
......@@ -49,17 +51,23 @@ build() {
export GOBIN="$GOPATH/bin"
msg2 "Building k3s..."
go build -o k3s
msg2 "Building kubectl..."
go build -o kubectl ./cmd/kubectl
mkdir -p build/data && ./scripts/download && go generate
TAGS="ctrd no_btrfs netcgo osusergo providerless static_build libsqlite3"
STATIC_SQLITE="-extldflags '-static -lm -ldl -lz -lpthread'"
VERSIONFLAGS="
-X github.com/rancher/k3s/pkg/version.Version=1.18.8+k3s1
-X github.com/rancher/k3s/pkg/version.GitCommit=AlpineLinux
"
GOLDFLAGS="-w -s"
go build -o k3s -tags "$TAGS" -ldflags "$VERSIONFLAGS $GOLDFLAGS $STATIC_SQLITE" ./cmd/server/main.go
}
package() {
install -m755 -D k3s \
"$pkgdir"/usr/bin/k3s
install -m755 -D kubectl \
"$pkgdir"/usr/bin/kubectl
install -m644 -D -t "$pkgdir"/usr/share/doc/$pkgname README.md
......@@ -70,7 +78,7 @@ package() {
}
sha512sums="1dec1359a204b4f182f98cf9b9416f0dd706d17f43f5b2b70bd091082a96ac0bb432a3485f8cf4a9dd4bac138ec835af606619b04a9a075956647d4a5de26ec8 k3s-1.18.8.1.tar.gz
134ff1f61c3dda3f5085387869db2873ad5e9a17c1080a3600d37ff48058e79cbcbea3df051c903c1d2e3ff0756dbfa54aa9ec4274b8c91db25912ff64e5357e k3s.confd
f03221efceb4ce2305c41c4c9e6d02ee5b799ed0cdfb1fc5018f8696e4d05575ae63b7c87596d765c5aa76c4a3bacf7c205e3eb61465e26886081a5d0da013ea k3s.confd
cff8db85337dd6b8a5126ea2c498fec09bc11cfdb856069ca78218cb5e58ce0c4c42a239e1d26bac9893f64ecc81fbdff64f7f937a960475b6298caafca0b36d k3s.initd
018a5e9b417a937c17f0a4a9e08eed434f06186207626ad038aec22ee667aba4cefa6e9e2a222e2c430d2cbb88c8663648f5bab0e76926a0edd13b8bdfd2673a k3s.logrotate
85ee1310cb36c85c42b4068a9549a3ef72b856cd61b2c1036c3e871ef43a69ed80b43599ad94ce5b069ddd823e730596bb3d3875d4ba8cd77c4cc1985335ffff k3s.modules-load"
# k3s options
export PATH="/usr/share/cni-plugins/bin/:$PATH"
export PATH="/usr/libexec/cni/:$PATH"
K3S_EXEC="server"
K3S_OPTS=""
#!/bin/sh
cd /
for link in kubectl crictl ctr; do
target=/usr/bin/$link
if [ ! -e $target ]; then
ln -s /usr/bin/k3s $target
fi
done
#!/bin/sh
cd /
for link in kubectl crictl ctr; do
target=/usr/bin/$link
if [ -L $target ] && [ "$(readlink $target)" = "/usr/bin/k3s" ]; then
rm $target
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment