mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-24 03:15:36 +00:00
kubernetes: better tolerate bad contents of /etc/kubeadm/kube-system.init/
Specifically ignore present-but-empty files entirely and ignore (but log) failure to apply any one file. Ignoring an empty file is useful because it means you can clobber a file which might be referenced from an images binds without needing to override those binds (since that generally means duplicating the whole lot which is annoying). Ignoring any failures to apply means the rest gets applied and the rest of the script (including untaint and the stamp file creation) still happen, resulting in a system where the admin just has to address the failures rather than the remaining updates. We touch a file to indicate failure generally plus one to indicate the specific yaml which failed to apply. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
581cbdd1e8
commit
425553d390
@ -11,9 +11,19 @@ else
|
||||
kubeadm init --skip-preflight-checks --kubernetes-version @KUBERNETES_VERSION@ $@
|
||||
fi
|
||||
for i in /etc/kubeadm/kube-system.init/*.yaml ; do
|
||||
n=$(basename "$i")
|
||||
if [ -e "$i" ] ; then
|
||||
echo "Applying "$(basename "$i")
|
||||
kubectl create -n kube-system -f "$i"
|
||||
if [ ! -s "$i" ] ; then # ignore zero sized files
|
||||
echo "Ignoring zero size file $n"
|
||||
continue
|
||||
fi
|
||||
echo "Applying $n"
|
||||
if ! kubectl create -n kube-system -f "$i" ; then
|
||||
touch /var/lib/kubeadm/.kubeadm-init.sh-kube-system.init-failed
|
||||
touch /var/lib/kubeadm/.kubeadm-init.sh-kube-system.init-"$n"-failed
|
||||
echo "Failed to apply $n"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -f /var/config/kubeadm/untaint-master ] ; then
|
||||
|
Loading…
Reference in New Issue
Block a user