Merge pull request #1186 from holser/resolv_conf

Set ClusterFirstWithHostNet for Pods with hostnetwork: true
This commit is contained in:
Matthew Mosesohn 2017-04-04 20:49:55 +03:00 committed by GitHub
commit f8cf6b4f7c
6 changed files with 14 additions and 1 deletions

View file

@ -4,7 +4,7 @@
dest: "{{kube_config_dir}}/{{item.file}}" dest: "{{kube_config_dir}}/{{item.file}}"
with_items: with_items:
- {file: netchecker-agent-ds.yml, type: ds, name: netchecker-agent} - {file: netchecker-agent-ds.yml, type: ds, name: netchecker-agent}
- {file: netchecker-agent-hostnet-ds.yml, type: ds, name: netchecker-agent-hostnet} - {file: netchecker-agent-hostnet-ds.j2, type: ds, name: netchecker-agent-hostnet}
- {file: netchecker-server-pod.yml, type: po, name: netchecker-server} - {file: netchecker-server-pod.yml, type: po, name: netchecker-server}
- {file: netchecker-server-svc.yml, type: svc, name: netchecker-service} - {file: netchecker-server-svc.yml, type: svc, name: netchecker-service}
register: manifests register: manifests

View file

@ -13,6 +13,9 @@ spec:
app: netchecker-agent-hostnet app: netchecker-agent-hostnet
spec: spec:
hostNetwork: True hostNetwork: True
{%- if kube_version | version_compare('v1.6', '>=') -%}
dnsPolicy: ClusterFirstWithHostNet
{%- endif -%}
containers: containers:
- name: netchecker-agent - name: netchecker-agent
image: "{{ agent_img }}" image: "{{ agent_img }}"

View file

@ -8,6 +8,9 @@ metadata:
kargo: v2 kargo: v2
spec: spec:
hostNetwork: true hostNetwork: true
{% if kube_version | version_compare('v1.6', '>=') %}
dnsPolicy: ClusterFirstWithHostNet
{% endif %}
containers: containers:
- name: kube-apiserver - name: kube-apiserver
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}

View file

@ -7,6 +7,9 @@ metadata:
k8s-app: kube-controller k8s-app: kube-controller
spec: spec:
hostNetwork: true hostNetwork: true
{%- if kube_version | version_compare('v1.6', '>=') -%}
dnsPolicy: ClusterFirstWithHostNet
{%- endif -%}
containers: containers:
- name: kube-controller-manager - name: kube-controller-manager
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}

View file

@ -7,6 +7,9 @@ metadata:
k8s-app: kube-scheduler k8s-app: kube-scheduler
spec: spec:
hostNetwork: true hostNetwork: true
{%- if kube_version | version_compare('v1.6', '>=') -%}
dnsPolicy: ClusterFirstWithHostNet
{%- endif -%}
containers: containers:
- name: kube-scheduler - name: kube-scheduler
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}

View file

@ -11,6 +11,7 @@
-v /etc/cni:/etc/cni:ro \ -v /etc/cni:/etc/cni:ro \
-v /opt/cni:/opt/cni:ro \ -v /opt/cni:/opt/cni:ro \
-v /etc/ssl:/etc/ssl:ro \ -v /etc/ssl:/etc/ssl:ro \
-v /etc/resolv.conf:/etc/resolv.conf \
{% for dir in ssl_ca_dirs -%} {% for dir in ssl_ca_dirs -%}
-v {{ dir }}:{{ dir }}:ro \ -v {{ dir }}:{{ dir }}:ro \
{% endfor -%} {% endfor -%}