From 925253c3d39c6428cef3619f27ad522ea5ceeeb5 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Wed, 20 Jul 2016 11:57:47 +0300 Subject: [PATCH 1/2] Add variable kube_resolv_conf Allow configuration of a custom /etc/resolv.conf for kubelet. --- roles/kubernetes/node/defaults/main.yml | 3 +++ roles/kubernetes/node/templates/kubelet.j2 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index 2997946f5..38ac1c6dc 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -29,6 +29,9 @@ kube_log_dir: "/var/log/kubernetes" dns_domain: "{{ cluster_name }}" +# resolv.conf to base dns config +kube_resolv_conf: "/etc/resolv.conf" + kube_proxy_mode: iptables # An experimental dev/test only dynamic volumes provisioner, diff --git a/roles/kubernetes/node/templates/kubelet.j2 b/roles/kubernetes/node/templates/kubelet.j2 index d96f7ff6e..20e521f73 100644 --- a/roles/kubernetes/node/templates/kubelet.j2 +++ b/roles/kubernetes/node/templates/kubelet.j2 @@ -21,7 +21,7 @@ KUBELET_REGISTER_NODE="--register-node=false" {% endif %} # location of the api-server {% if dns_setup %} -KUBELET_ARGS="--cluster_dns={{ dns_server }} --cluster_domain={{ dns_domain }} --kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml --config={{ kube_manifest_dir }}" +KUBELET_ARGS="--cluster_dns={{ dns_server }} --cluster_domain={{ dns_domain }} --kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml --config={{ kube_manifest_dir }} --resolv-conf={{ kube_resolv_conf }}" {% else %} KUBELET_ARGS="--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig --config={{ kube_manifest_dir }}" {% endif %} From 01e554fdb354b6cf75c457f9ba80a81be7538390 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 20 Jul 2016 11:35:06 +0200 Subject: [PATCH 2/2] Fix set_facts visibility Move set_facts to the preinstall scope, so every role may see it. For example, network plugins to see the etcd_endpoint. Signed-off-by: Bogdan Dobrelya --- roles/etcd/tasks/main.yml | 1 - roles/kubernetes/preinstall/tasks/main.yml | 2 ++ roles/{etcd => kubernetes/preinstall}/tasks/set_facts.yml | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename roles/{etcd => kubernetes/preinstall}/tasks/set_facts.yml (100%) diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index 34d94ab73..733f6475b 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -1,5 +1,4 @@ --- -- include: set_facts.yml - include: install.yml - include: set_cluster_health.yml - include: configure.yml diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 95cd134ce..c0dd65797 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -2,6 +2,8 @@ - include: gitinfos.yml when: run_gitinfos +- include: set_facts.yml + - name: gather os specific variables include_vars: "{{ item }}" with_first_found: diff --git a/roles/etcd/tasks/set_facts.yml b/roles/kubernetes/preinstall/tasks/set_facts.yml similarity index 100% rename from roles/etcd/tasks/set_facts.yml rename to roles/kubernetes/preinstall/tasks/set_facts.yml