Skip to content

Commit

Permalink
hostnameOverride on a per-node basis (#3708)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirwan authored and k8s-ci-robot committed Nov 14, 2018
1 parent d8e9b0f commit 3fafa58
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ cloudProvider: {{ cloud_provider }}
kubeProxy:
config:
mode: {{ kube_proxy_mode }}
hostnameOverride: {{ inventory_hostname }}
{% if kube_proxy_nodeport_addresses %}
nodePortAddresses: [{{ kube_proxy_nodeport_addresses_cidr }}]
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ conntrack:
tcpEstablishedTimeout: 24h0m0s
enableProfiling: false
healthzBindAddress: 0.0.0.0:10256
hostnameOverride: {{ inventory_hostname }}
iptables:
masqueradeAll: false
masqueradeBit: 14
Expand Down
27 changes: 27 additions & 0 deletions roles/win_nodes/kubernetes_patch/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@
recurse: yes
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
block:
- name: Copy kube-proxy daemonset nodeselector patch
Expand Down

0 comments on commit 3fafa58

Please sign in to comment.