From cecb5a65b73fec65b4d2b2398412347adfe2ffd4 Mon Sep 17 00:00:00 2001 From: David Scott Date: Wed, 4 Oct 2017 15:31:48 +0100 Subject: [PATCH] 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 --- projects/kubernetes/kubernetes/kubeadm-init.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/kubernetes/kubernetes/kubeadm-init.sh b/projects/kubernetes/kubernetes/kubeadm-init.sh index 0aa1895f2..87feee6f6 100755 --- a/projects/kubernetes/kubernetes/kubeadm-init.sh +++ b/projects/kubernetes/kubernetes/kubeadm-init.sh @@ -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")