From 03c61685fb97a0ab16bf05333c3c7116864bee99 Mon Sep 17 00:00:00 2001 From: Maxim Krasilnikov Date: Mon, 12 Feb 2018 10:29:46 +0300 Subject: [PATCH] Added apiserver extra args variable for kubeadm config (#2291) --- roles/kubernetes/master/defaults/main.yml | 1 + roles/kubernetes/master/templates/kubeadm-config.yaml.j2 | 3 +++ .../master/templates/manifests/kube-apiserver.manifest.j2 | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/kubernetes/master/defaults/main.yml b/roles/kubernetes/master/defaults/main.yml index 6b22bfd05..64a71fc22 100644 --- a/roles/kubernetes/master/defaults/main.yml +++ b/roles/kubernetes/master/defaults/main.yml @@ -83,6 +83,7 @@ controller_mgr_custom_flags: [] scheduler_custom_flags: [] ## Extra args for k8s components passing by kubeadm +kube_kubeadm_apiserver_extra_args: {} kube_kubeadm_controller_extra_args: {} kube_kubeadm_scheduler_extra_args: {} diff --git a/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 index 1f243e544..ed1cc7add 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 @@ -58,6 +58,9 @@ apiServerExtraArgs: runtime-config: {{ kube_api_runtime_config | join(',') }} {% endif %} allow-privileged: "true" +{% for key in kube_kubeadm_apiserver_extra_args %} + {{ key }}: {{ kube_kubeadm_apiserver_extra_args[key] }} +{% endfor %} controllerManagerExtraArgs: node-monitor-grace-period: {{ kube_controller_node_monitor_grace_period }} node-monitor-period: {{ kube_controller_node_monitor_period }} diff --git a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 index f8e33de14..a6f76c6d6 100644 --- a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 +++ b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 @@ -115,9 +115,9 @@ spec: {% if apiserver_custom_flags is string %} - {{ apiserver_custom_flags }} {% else %} -{% for flag in apiserver_custom_flags %} +{% for flag in apiserver_custom_flags %} - {{ flag }} -{% endfor %} +{% endfor %} {% endif %} livenessProbe: httpGet: