# Contributor: Mateusz Mikuła <matti@marinelayer.io>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=kubernetes
pkgver=1.8.5
pkgrel=0
pkgdesc="Container Cluster Manager for Docker"
url="http://kubernetes.io/"
arch="x86_64"
license="Apache"
options="!check !nostrip"
depends="bash"
makedepends="bash coreutils findutils go linux-headers rsync"
source="$pkgname-$pkgver.tar.gz::https://dl.k8s.io/v$pkgver/kubernetes-src.tar.gz
	no-gnu-grep.patch
	make-e2e_node-run-over-distro-bins.patch
	make-test-cmd-run-over-hyperkube-based-kubectl.patch
	fix-support-for-ppc64le.patch
	remove-apiserver-add-kube-prefix-for-hyperkube.patch
	"
builddir="$srcdir"/build

unpack() {
	mkdir -p $builddir
	tar -xf $srcdir/$pkgname-$pkgver.tar.gz -C $builddir
}

build() {
	cd "$builddir"
	make -j1
}

package() {
	cd "$builddir"
	binaries="kube-proxy
			kube-apiserver
			kube-controller-manager
			kubelet
			kubeadm
			hyperkube
			kube-aggregator
			kube-scheduler
			kubectl
			kubefed"
	for bin in $binaries; do
		install -Dm755 _output/local/bin/linux/amd64/$bin "$pkgdir"/usr/bin/$bin
	done
	install -Dm755 examples/cockroachdb/minikube.sh "$pkgdir"/usr/sbin/minikube.sh
	install -d $pkgdir/var/lib/kubelet
}

sha512sums="fbf3ebb130b735ce6b31cf666b0c3914380c1117d4efece75b6b269016d552777862f70267d9bc5e3feeddd7e15107881e6f99c100bfd3b0d9bbef1325f645ea  kubernetes-1.8.5.tar.gz
bf83357a169ecdabffdbefa0e9b24e01fbd99f289e846d34506ae3d32c599c6f9b8acac9a96cb587177eb62f48f0530088280cd1aa425c780daa1c6087e4d730  no-gnu-grep.patch
06e3e8626b70077eb693da9c53dca3bc566aea4590a27c5dd3997b6d34abec5bf5d749b7be94b60b83361884c29b3a6dbb56c40b18c008b19e7cbd6e0d5c87e6  make-e2e_node-run-over-distro-bins.patch
07ecfbdb005250c65360a7357aeaacd1b342658c6685d37c0ea6b4740e4aebebc0213f74a81926bc0a6262161602d53f0c6cb6f19c5ecfb3be90c9372dc3cccd  make-test-cmd-run-over-hyperkube-based-kubectl.patch
ff043b723edc644a8270a471bfb45b400a4547a9dd70b28c5c27dc041d956da2d1da36422694b35ac589a7ca651de44c7346d3d63fd36ec570bab7325a6fd73b  fix-support-for-ppc64le.patch
469a93156ea5919fa77e54a0a142bf44a899d841bdf180a78ab5fd751891b18d675bd6b807f04da85fc7962c43e2f840a4587c3145e7829878089a3b17ec187e  remove-apiserver-add-kube-prefix-for-hyperkube.patch"
