2018-06-05 11:15:20 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure that user manifests directory exists
|
|
|
|
file:
|
|
|
|
path: "{{ kubernetes_user_manifests_path }}/kubernetes"
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
tags: [init, cni]
|
|
|
|
|
|
|
|
- name: Apply kube-proxy nodeselector
|
|
|
|
block:
|
|
|
|
# Due to https://github.com/kubernetes/kubernetes/issues/58212 we cannot rely on exit code for "kubectl patch"
|
|
|
|
- name: Check current nodeselector for kube-proxy daemonset
|
2020-03-11 12:17:36 +00:00
|
|
|
command: >-
|
2022-01-05 10:26:32 +00:00
|
|
|
{{ kubectl }}
|
2020-03-11 12:17:36 +00:00
|
|
|
get ds kube-proxy --namespace=kube-system
|
2022-01-05 10:26:32 +00:00
|
|
|
-o jsonpath={.spec.template.spec.nodeSelector.{{ kube_proxy_nodeselector | regex_replace('\.', '\\.') }}}
|
2018-06-05 11:15:20 +00:00
|
|
|
register: current_kube_proxy_state
|
2019-12-11 19:23:55 +00:00
|
|
|
retries: 60
|
|
|
|
delay: 5
|
|
|
|
until: current_kube_proxy_state is succeeded
|
2020-03-11 12:17:36 +00:00
|
|
|
changed_when: false
|
2018-06-05 11:15:20 +00:00
|
|
|
|
|
|
|
- name: Apply nodeselector patch for kube-proxy daemonset
|
2022-01-05 10:26:32 +00:00
|
|
|
command: >
|
|
|
|
{{ kubectl }}
|
2020-03-11 12:17:36 +00:00
|
|
|
patch ds kube-proxy --namespace=kube-system --type=strategic -p
|
2020-04-20 15:43:39 +00:00
|
|
|
'{"spec":{"template":{"spec":{"nodeSelector":{"{{ kube_proxy_nodeselector }}":"linux"} }}}}'
|
2018-06-05 11:15:20 +00:00
|
|
|
register: patch_kube_proxy_state
|
|
|
|
when: current_kube_proxy_state.stdout | trim | lower != "linux"
|
|
|
|
|
2021-07-12 07:00:47 +00:00
|
|
|
- debug: # noqa unnamed-task
|
|
|
|
msg: "{{ patch_kube_proxy_state.stdout_lines }}"
|
2018-06-05 11:15:20 +00:00
|
|
|
when: patch_kube_proxy_state is not skipped
|
|
|
|
|
2021-07-12 07:00:47 +00:00
|
|
|
- debug: # noqa unnamed-task
|
|
|
|
msg: "{{ patch_kube_proxy_state.stderr_lines }}"
|
2018-06-05 11:15:20 +00:00
|
|
|
when: patch_kube_proxy_state is not skipped
|
|
|
|
tags: init
|
2018-10-16 14:15:05 +00:00
|
|
|
when:
|
2020-09-17 11:30:45 +00:00
|
|
|
- kube_proxy_deployed
|