Rename default_resolver to cloud_resolver (#2209)
Cloud resolvers are mandatory for hosts on GCE and OpenStack clouds. The 8.8.8.8 alternative resolver was dropped because there is already a default nameserver. The new var name reflects the purpose better. Also restart apiserver when modifying dns settings.
This commit is contained in:
parent
3846384d56
commit
2df4b6c5d2
2 changed files with 22 additions and 7 deletions
|
@ -5,7 +5,9 @@
|
||||||
- Preinstall | reload network
|
- Preinstall | reload network
|
||||||
- Preinstall | reload kubelet
|
- Preinstall | reload kubelet
|
||||||
- Preinstall | kube-controller configured
|
- Preinstall | kube-controller configured
|
||||||
|
- Preinstall | kube-apiserver configured
|
||||||
- Preinstall | restart kube-controller-manager
|
- Preinstall | restart kube-controller-manager
|
||||||
|
- Preinstall | restart kube-apiserver
|
||||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||||
|
|
||||||
# FIXME(bogdando) https://github.com/projectcalico/felix/issues/1185
|
# FIXME(bogdando) https://github.com/projectcalico/felix/issues/1185
|
||||||
|
@ -37,14 +39,27 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
notify:
|
notify:
|
||||||
- Preinstall | kube-controller configured
|
- Preinstall | kube-controller configured
|
||||||
|
- Preinstall | kube-apiserver configured
|
||||||
- Preinstall | restart kube-controller-manager
|
- Preinstall | restart kube-controller-manager
|
||||||
|
- Preinstall | restart kube-apiserver
|
||||||
when: not dns_early|bool
|
when: not dns_early|bool
|
||||||
|
|
||||||
|
# FIXME(mattymo): Also restart for kubeadm mode
|
||||||
|
- name: Preinstall | kube-apiserver configured
|
||||||
|
stat: path="{{ kube_manifest_dir }}/kube-apiserver.manifest"
|
||||||
|
register: kube_apiserver_set
|
||||||
|
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
||||||
|
|
||||||
|
# FIXME(mattymo): Also restart for kubeadm mode
|
||||||
- name: Preinstall | kube-controller configured
|
- name: Preinstall | kube-controller configured
|
||||||
stat: path="{{ kube_manifest_dir }}/kube-controller-manager.manifest"
|
stat: path="{{ kube_manifest_dir }}/kube-controller-manager.manifest"
|
||||||
register: kube_controller_set
|
register: kube_controller_set
|
||||||
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
||||||
|
|
||||||
- name: Preinstall | restart kube-controller-manager
|
- name: Preinstall | restart kube-controller-manager
|
||||||
shell: "docker ps -f name=k8s_kube-controller-manager* -q | xargs --no-run-if-empty docker rm -f"
|
shell: "docker ps -f name=k8s_POD_kube-controller-manager* -q | xargs --no-run-if-empty docker rm -f"
|
||||||
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf' and kube_controller_set.stat.exists
|
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf' and kube_controller_set.stat.exists
|
||||||
|
|
||||||
|
- name: Preinstall | restart kube-apiserver
|
||||||
|
shell: "docker ps -f name=k8s_POD_kube-apiserver* -q | xargs --no-run-if-empty docker rm -f"
|
||||||
|
when: inventory_hostname in groups['kube-master'] and dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
{% for d in [ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([]) -%}
|
{% for d in [ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([]) -%}
|
||||||
{{dns_domain}}.{{d}}./{{d}}.{{d}}./com.{{d}}./
|
{{dns_domain}}.{{d}}./{{d}}.{{d}}./com.{{d}}./
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
default_resolver: >-
|
cloud_resolver: >-
|
||||||
{%- if cloud_provider is defined and cloud_provider == 'gce' -%}
|
{%- if cloud_provider is defined and cloud_provider == 'gce' -%}
|
||||||
169.254.169.254
|
['169.254.169.254']
|
||||||
{%- elif cloud_provider is defined and cloud_provider == 'aws' -%}
|
{%- elif cloud_provider is defined and cloud_provider == 'aws' -%}
|
||||||
169.254.169.253
|
['169.254.169.253']
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
8.8.8.8
|
[]
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
- name: check if kubelet is configured
|
- name: check if kubelet is configured
|
||||||
|
@ -106,6 +106,6 @@
|
||||||
- name: generate nameservers to resolvconf
|
- name: generate nameservers to resolvconf
|
||||||
set_fact:
|
set_fact:
|
||||||
nameserverentries:
|
nameserverentries:
|
||||||
nameserver {{( dnsmasq_server + nameservers|default([default_resolver])) | join(',nameserver ')}}
|
nameserver {{( dnsmasq_server + nameservers|d([]) + cloud_resolver|d([])) | join(',nameserver ')}}
|
||||||
supersede_nameserver:
|
supersede_nameserver:
|
||||||
supersede domain-name-servers {{( dnsmasq_server + nameservers|default([default_resolver])) | join(', ') }};
|
supersede domain-name-servers {{( dnsmasq_server + nameservers|d([]) + cloud_resolver|d([])) | join(', ') }};
|
||||||
|
|
Loading…
Reference in a new issue