summaryrefslogtreecommitdiff
path: root/testing/flannel/APKBUILD
blob: 6f3dd74881b66990124bd92c5cd32c81342e28f7 (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
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=flannel
_pkgname=flanneld
pkgver=0.21.5
pkgrel=0
pkgdesc="An etcd backed network fabric for containers"
url="https://github.com/flannel-io/flannel"
arch="x86_64"
license="Apache-2.0"
options="net"
makedepends="go linux-headers"
subpackages="$pkgname-openrc $pkgname-contrib-cni:contrib_cni:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/flannel-io/flannel/archive/refs/tags/v$pkgver.tar.gz
$_pkgname.logrotated
$_pkgname.initd
$_pkgname.confd"
builddir="$srcdir/$pkgname-$pkgver"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	mkdir -p out
	go build \
		-mod=readonly \
		-ldflags "-s -w -X github.com/flannel-io/flannel/version.Version=$pkgver" \
		-o "out/$_pkgname"
}

check() {
	./out/flanneld --version
}

package() {
	install -Dm0755 out/$_pkgname "$pkgdir"/usr/bin/$_pkgname
	install -Dm755 "$srcdir"/$_pkgname.initd \
		"$pkgdir"/etc/init.d/$_pkgname
	install -Dm755 "$srcdir"/$_pkgname.confd \
		"$pkgdir"/etc/conf.d/$_pkgname
	install -Dm644 "$srcdir"/$_pkgname.logrotated \
		"$pkgdir"/etc/logrotate.d/$_pkgname
	install -d "$pkgdir"/var/log/$pkgname
	install -d "$pkgdir"/var/run/$pkgname
}

contrib_cni() {
	pkgdesc="$pkgname contrib cni config files"
	mkdir -p "$subpkgdir"/etc/cni/net.d
	install -Dm0755 "$builddir"/dist/mk-docker-opts.sh "$subpkgdir"/usr/bin/mk-docker-opts.sh
	install -Dm0755 "$builddir"/dist/iptables-wrapper-installer.sh "$subpkgdir"/usr/bin/iptables-wrapper-installer.sh
	install -Dm0644 "$builddir"/Documentation/kube-flannel.yml \
		"$subpkgdir"/etc/kube-flannel/kube-flannel.yml
	install -Dm0644 "$builddir"/Documentation/k8s-old-manifests/kube-flannel-legacy.yml \
		"$subpkgdir"/etc/kube-flannel/kube-flannel-legacy.tml
}

cleanup_srcdir() {
        export GOPATH="$srcdir"
        go clean -modcache
        default_cleanup_srcdir
}

sha512sums="
29a2f5ffb53cf7dcdf87c30aea7365ee9405761ac2481c2428cbadc13dadea4afa833723f4e9b292e4e192d00cbefd7c15d8a3a16363c6d98832bcdf8cfe9600  flannel-0.21.5.tar.gz
d84258a164adcec0f1cef7fcafcf0cadb3bf3959b393b905c4897274adeff476279ce96ec42e9aa9d574c6bd7d37649d92c7c52563975f85d303cade990a3942  flanneld.logrotated
3f6f33fe90adca1dd17b503ce0cd3a7f3cc0ca7fc10d0ca5b631f4c87ed513c0133dfd7679618cf95540b252b3176f9bbefd6454867ef792258c46cafc039d86  flanneld.initd
353b98bfc1a73d8f691b6f79489e0224961b5af8ca36ce2edde2d7a86790612de1d597c3455222f38a1c9f09b377e1bf3adfeedc04bd6b0b75c653a732d58988  flanneld.confd
"