k8s_fedora: Label master nodes with kubectl

Due to [0], we can not label nodes with
node-role.kubernetes.io/master="". We need to do it with the kubernetes
API.

[0] https://github.com/kubernetes/kubernetes/issues/75457

story: 2006459
task: 36872

Change-Id: I2dc2a125c49f9fc33aa02d3d0c99a5bb0eec1156
Signed-off-by: Spyros Trigazis <spyridon.trigazi@cern.ch>
(cherry picked from commit 9dc92654d2)
This commit is contained in:
Spyros Trigazis 2019-09-29 11:22:56 +00:00 committed by Bharat Kunwar
parent ca7eed7ac0
commit 7aa12a550d
2 changed files with 9 additions and 2 deletions

View File

@ -178,7 +178,6 @@ if [ "$NETWORK_DRIVER" = "calico" ]; then
KUBELET_ARGS="${KUBELET_ARGS} --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
fi
KUBELET_ARGS="${KUBELET_ARGS} --register-with-taints=CriticalAddonsOnly=True:NoSchedule,dedicated=master:NoSchedule"
KUBELET_ARGS="${KUBELET_ARGS} --node-labels=node-role.kubernetes.io/master=\"\""
KUBELET_KUBECONFIG=/etc/kubernetes/kubelet-config.yaml
cat << EOF >> ${KUBELET_KUBECONFIG}

View File

@ -18,4 +18,12 @@ for service in etcd docker kube-apiserver kube-controller-manager kube-scheduler
echo "activating service $service"
systemctl enable $service
systemctl --no-block start $service
done
done
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ] && \
kubectl patch node ${INSTANCE_NAME} \
--patch '{"metadata": {"labels": {"node-role.kubernetes.io/master": ""}}}'
do
echo "Trying to label master node with node-role.kubernetes.io/master=\"\""
sleep 5s
done