kubernetes: add optional support for a kubeadm.yaml

Unfortunately some options (such as enabling dynamic registration of
initializers) can only be enabled by a `--config foo.yaml` argument.
Furthermore some command-line options (such as the kubernetes version)
cannot be used in combination with the config file.

This patch checks for a supplied  /etc/kubeadm/kubeadm.yaml and uses
it if it exists, otherwise it falls back to the original command-line.
Note it is safe to use the `--skip-*` options in combination with the
`--config` option.

Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
David Scott 2017-10-04 15:31:48 +01:00
parent be3ffe5bf6
commit cecb5a65b7

View File

@ -1,7 +1,15 @@
#!/bin/sh
set -e
touch /var/lib/kubeadm/.kubeadm-init.sh-started
kubeadm init --skip-preflight-checks --kubernetes-version @KUBERNETES_VERSION@ $@
if [ -f /etc/kubeadm/kubeadm.yaml ]; then
echo Using the configuration from /etc/kubeadm/kubeadm.yaml
if [ $# -ne 0 ] ; then
echo WARNING: Ignoring command line options: $@
fi
kubeadm init --skip-preflight-checks --config /etc/kubeadm/kubeadm.yaml
else
kubeadm init --skip-preflight-checks --kubernetes-version @KUBERNETES_VERSION@ $@
fi
for i in /etc/kubeadm/kube-system.init/*.yaml ; do
if [ -e "$i" ] ; then
echo "Applying "$(basename "$i")