Fix failure of systemd service kube-ui

The systemd service kube-ui failed because it does not
know the HOME environment variable.
Also updated script to handle already existing namespace,
rc and service.

Similar issue from upstream is as follows:
https://github.com/kubernetes/kubernetes/pull/23975

Change-Id: I71925a232b57f3c2cdfe82ae97b3fd7395e37343
Co-Authored-By: yatinkarel <yatin.karel@nectechnologies.in>
Closes-Bug: #1584931
This commit is contained in:
Hongbin Lu 2016-09-28 16:57:20 +05:30 committed by yatinkarel
parent 5dae4c54cb
commit 865702f5b3
2 changed files with 22 additions and 5 deletions

View File

@ -32,7 +32,12 @@ do
sleep 5
done
/usr/bin/kubectl create -f /srv/kubernetes/kube-system-namespace.json
#check for existence of namespace
/usr/bin/kubectl get namespace kube-system
if [ "\$?" != "0" ]; then
/usr/bin/kubectl create -f /srv/kubernetes/kube-system-namespace.json
fi
EOF
}

View File

@ -86,8 +86,19 @@ do
sleep 5
done
/usr/bin/kubectl create -f /srv/kubernetes/manifests/kube-ui-rc.yaml --namespace=kube-system
/usr/bin/kubectl create -f /srv/kubernetes/manifests/kube-ui-svc.yaml --namespace=kube-system
#echo check for existence of kube-ui-v4 replication controller
/usr/bin/kubectl get rc kube-ui-v4 --namespace=kube-system
if [ "\$?" != "0" ]; then
/usr/bin/kubectl create -f /srv/kubernetes/manifests/kube-ui-rc.yaml --namespace=kube-system
fi
#echo check for existence of kube-ui service
/usr/bin/kubectl get service kube-ui --namespace=kube-system
if [ "\$?" != "0" ]; then
/usr/bin/kubectl create -f /srv/kubernetes/manifests/kube-ui-svc.yaml --namespace=kube-system
fi
EOF
}
@ -97,12 +108,13 @@ KUBE_UI_SERVICE=/etc/systemd/system/kube-ui.service
mkdir -p $(dirname ${KUBE_UI_SERVICE})
cat << EOF > ${KUBE_UI_SERVICE}
[Unit]
After=kube-system-namespace
After=kube-system-namespace.service
Requires=kubelet.service
Requires=kube-system-namespace.service
Wants=kube-system-namespace.service
[Service]
Type=oneshot
Environment=HOME=/root
EnvironmentFile=-/etc/kubernetes/config
ExecStart=${KUBE_UI_BIN}