From 59e95aee291a9ff295d467efadf04199ffc7173c Mon Sep 17 00:00:00 2001
From: Dave <dj.2dixx@gmail.com>
Date: Fri, 8 May 2020 20:55:51 +0000
Subject: [PATCH] testing/kubernetes: several improvement

- fix kubelet service issue on start
- add support for kubeadm
- change kubelet default location for cni-plugins
---
 testing/kubernetes/APKBUILD      |  9 +++++----
 testing/kubernetes/kubelet.confd |  2 +-
 testing/kubernetes/kubelet.initd | 10 +++++++++-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/testing/kubernetes/APKBUILD b/testing/kubernetes/APKBUILD
index cd015ea6360f..895665f6046c 100644
--- a/testing/kubernetes/APKBUILD
+++ b/testing/kubernetes/APKBUILD
@@ -1,11 +1,12 @@
 # Contributor: Francesco Colista <fcolista@alpinelinux.org>
 # Contributor: Mateusz Mikuła <matti@marinelayer.io>
 # Contributor: Tiago Ilieve <tiago.myhro@gmail.com>
+# Contributor: Dave <dj.2dixx@gmail.com>
 # Maintainer: Francesco Colista <fcolista@alpinelinux.org>
 pkgname=kubernetes
 pkgver=1.17.3
-pkgrel=1
-pkgdesc="Container Cluster Manager for Docker"
+pkgrel=2
+pkgdesc="Container Cluster Manager"
 url="https://kubernetes.io/"
 arch="x86_64 armhf"
 license="Apache-2.0"
@@ -104,6 +105,6 @@ d7e022ee22da191bda7382f87cb293d9c9d115a3df0c2054bf918279eb866f99c6d5c21e4c98eae8
 151ea6f5cc36de9b83f0e5365579e33eea8002f9a03f5f61d195a349236e6baf192f701d3fb591b769aa90e8e1e620d525b20c95a1e8cda58d062971d8f587a3  kube-scheduler.initd
 af88b382ab75657d0ff13c3f8f6d924cef9f2df7807a9a27daa63495981801bc4b607998f65c0758c11a7e070e43c24f7184ba7720711109c74b1c4d57919e34  kube-scheduler.confd
 3692da349dd6ed0f5acc09d7b95ac562ffecb103e2270bebdfe4a7808d48dada9d2debff262d85b11c47f9ca3f0c20000712d03629ed813ff08a3e02d69267e6  kube-scheduler.logrotated
-6f8268eb8626d2e5d884e8a714861abebc92f1e7ebc9d50ab6d122fdec4e88aa672a3df900c3ce1deac36ba9991c914d7564adc0ef0e965b5975a86d51874962  kubelet.initd
-3aba3d7175b58b9175e508d50fce93619a8e0205a828f677fd987d449ecb50b2805febc2ba429cb176de30eee3d49892e10a72946100e1219e090fd0397712d2  kubelet.confd
+92dc0fa1d34cec1ca5a9433a28036d6c40e4919b8fea44d161f3c72866cd97c754072c5f53023780d7ca7210d58db26753dcba8068033e1651925b30e4131ed1  kubelet.initd
+d4a3d7aa06e86df1535adb46cda62a7c5041b7bc66310dddcf7e6553476e5ba4d4c974f1ff635ccbd17c1b99b12dfb0bb537e82e3acf95049e762e282cc155f7  kubelet.confd
 dda5fb57b55926fd2e9cebe6c1593da699afba0398c58dfa8b923c53a9ae6e63d765778577211460047f20863a6095e8e2ab3e7769e38c4f6a1c55c0e3485501  kubelet.logrotated"
diff --git a/testing/kubernetes/kubelet.confd b/testing/kubernetes/kubelet.confd
index d5cf00c4df0d..6053aaba8e22 100644
--- a/testing/kubernetes/kubelet.confd
+++ b/testing/kubernetes/kubelet.confd
@@ -1,4 +1,4 @@
 ###
 # Kubernetes Kubelet (worker) config
 
-command_args="--kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml"
+command_args="--cni-bin-dir=/usr/share/cni-plugins/bin --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml"
diff --git a/testing/kubernetes/kubelet.initd b/testing/kubernetes/kubelet.initd
index 2f6b4eaf5df5..c8c4812334f8 100644
--- a/testing/kubernetes/kubelet.initd
+++ b/testing/kubernetes/kubelet.initd
@@ -7,8 +7,12 @@ pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"}
 user=${user:-root}
 group=${group:-root}
 
+if [ -e /var/lib/kubelet/kubeadm-flags.env ]; then
+  source /var/lib/kubelet/kubeadm-flags.env;
+fi
+
 command="/usr/bin/kubelet"
-command_args="${command_args}"
+command_args="${command_args} ${KUBELET_KUBEADM_ARGS}"
 command_background="true"
 start_stop_daemon_args="--user ${user} --group ${group} \
 	--stdout /var/log/kubelet/${SVCNAME}.log \
@@ -18,3 +22,7 @@ depend() {
 	need net
 	after net
 }
+
+start_pre() {
+	mkdir -p /run/${SVCNAME}
+}
-- 
GitLab