aboutsummaryrefslogtreecommitdiffstats
path: root/community/k3s/APKBUILD
blob: 80f6afcfe7727e6a2a1ef9ee465059cea3c6400d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=k3s
_pkgver=1.20.2+k3s1
pkgver=${_pkgver/+k3s/.}
pkgrel=0
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 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
	k3s.initd
	k3s.logrotate
	k3s.modules-load
	"
builddir="$srcdir/src/github.com/rancher/$pkgname"

# secfixes:
#   1.19.4.2-r0:
#     - CVE-2020-15257
#   1.18.6.1-r0:
#     - CVE-2020-8557
#     - CVE-2020-8559
#   1.18.3.1-r0:
#     - CVE-2020-10749
#     - CVE-2020-8555
#   0.8.1-r0:
#     - CVE-2019-9512
#     - CVE-2019-9514
#   0.8.0-r0:
#     - CVE-2019-11247
#     - CVE-2019-11249

prepare() {
	export GOPATH="$srcdir"

	mkdir -p "$(dirname $builddir)"
	mv "$srcdir"/$pkgname-${_pkgver/+/-} "$builddir"/

	default_prepare
}

build() {
	msg2 "Prepare GOPATH and GOBIN..."
	export GOPATH="$srcdir"
	export GOBIN="$GOPATH/bin"

	msg2 "Building k3s..."

	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=$_pkgver
	-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 -m644 -D -t "$pkgdir"/usr/share/doc/$pkgname README.md

	install -m755 -D "$srcdir"/k3s.initd "$pkgdir"/etc/init.d/k3s
	install -m644 -D "$srcdir"/k3s.confd "$pkgdir"/etc/conf.d/k3s
	install -m644 -D "$srcdir"/k3s.logrotate "$pkgdir"/etc/logrotate.d/k3s
	install -m644 -D "$srcdir"/k3s.modules-load "$pkgdir"/etc/modules-load.d/k3s.conf
}

sha512sums="f381d6d3c481b686dbe673c8133d390925d601cc044af684b9bb0e6d4a3c7124c0e5ead3a569651b22ac5a0140a1c764030d1ba287b84dd0ca488a1c69efd647  k3s-1.20.2.1.tar.gz
f03221efceb4ce2305c41c4c9e6d02ee5b799ed0cdfb1fc5018f8696e4d05575ae63b7c87596d765c5aa76c4a3bacf7c205e3eb61465e26886081a5d0da013ea  k3s.confd
1015ee6ce5c69595df3150d7bbdfe528cf20305dac299831faa9cce00a454daf5548e78b1db79dcb8da300edc54553dfda0b95aed5e7bee27c1c726aef640350  k3s.initd
018a5e9b417a937c17f0a4a9e08eed434f06186207626ad038aec22ee667aba4cefa6e9e2a222e2c430d2cbb88c8663648f5bab0e76926a0edd13b8bdfd2673a  k3s.logrotate
85ee1310cb36c85c42b4068a9549a3ef72b856cd61b2c1036c3e871ef43a69ed80b43599ad94ce5b069ddd823e730596bb3d3875d4ba8cd77c4cc1985335ffff  k3s.modules-load"