hostnameOverride on a per-node basis (#3708)

pull/3710/head
Erwan Miran 2018-11-14 18:37:53 +01:00 committed by k8s-ci-robot
parent d8e9b0f675
commit 3fafa583d1
3 changed files with 27 additions and 2 deletions

View File

@ -28,7 +28,6 @@ cloudProvider: {{ cloud_provider }}
kubeProxy: kubeProxy:
config: config:
mode: {{ kube_proxy_mode }} mode: {{ kube_proxy_mode }}
hostnameOverride: {{ inventory_hostname }}
{% if kube_proxy_nodeport_addresses %} {% if kube_proxy_nodeport_addresses %}
nodePortAddresses: [{{ kube_proxy_nodeport_addresses_cidr }}] nodePortAddresses: [{{ kube_proxy_nodeport_addresses_cidr }}]
{% endif %} {% endif %}

View File

@ -180,7 +180,6 @@ conntrack:
tcpEstablishedTimeout: 24h0m0s tcpEstablishedTimeout: 24h0m0s
enableProfiling: false enableProfiling: false
healthzBindAddress: 0.0.0.0:10256 healthzBindAddress: 0.0.0.0:10256
hostnameOverride: {{ inventory_hostname }}
iptables: iptables:
masqueradeAll: false masqueradeAll: false
masqueradeBit: 14 masqueradeBit: 14

View File

@ -7,6 +7,33 @@
recurse: yes recurse: yes
tags: [init, cni] tags: [init, cni]
- name: Apply kube-proxy hostnameOverride
block:
- name: Copy kube-proxy daemonset hostnameOverride patch
copy:
src: hostnameOverride-patch.json
dest: "{{ kubernetes_user_manifests_path }}/hostnameOverride-patch.json"
- name: Check current command for kube-proxy daemonset
shell: "{{bin_dir}}/kubectl get ds kube-proxy --namespace=kube-system -o jsonpath='{.spec.template.spec.containers[0].command}'"
register: current_kube_proxy_command
- name: Apply hostnameOverride patch for kube-proxy daemonset
shell: "{{bin_dir}}/kubectl patch ds kube-proxy --namespace=kube-system --type=strategic -p \"$(cat hostnameOverride-patch.json)\""
args:
chdir: "{{ kubernetes_user_manifests_path }}"
register: patch_kube_proxy_command
when: not current_kube_proxy_command.stdout is search("--hostname-override=${NODE_NAME}")
- debug: msg={{ patch_kube_proxy_command.stdout_lines }}
when: patch_kube_proxy_command is not skipped
- debug: msg={{ patch_kube_proxy_command.stderr_lines }}
when: patch_kube_proxy_command is not skipped
tags: init
when:
- not kube_proxy_remove
- name: Apply kube-proxy nodeselector - name: Apply kube-proxy nodeselector
block: block:
- name: Copy kube-proxy daemonset nodeselector patch - name: Copy kube-proxy daemonset nodeselector patch