You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

  1. ---
  2. - name: Ensure that user manifests directory exists
  3. file:
  4. path: "{{ kubernetes_user_manifests_path }}/kubernetes"
  5. state: directory
  6. recurse: yes
  7. tags: [init, cni]
  8. - name: Apply kube-proxy nodeselector
  9. tags: init
  10. when:
  11. - kube_proxy_deployed
  12. block:
  13. # Due to https://github.com/kubernetes/kubernetes/issues/58212 we cannot rely on exit code for "kubectl patch"
  14. - name: Check current nodeselector for kube-proxy daemonset
  15. command: >-
  16. {{ kubectl }}
  17. get ds kube-proxy --namespace=kube-system
  18. -o jsonpath={.spec.template.spec.nodeSelector.{{ kube_proxy_nodeselector | regex_replace('\.', '\\.') }}}
  19. register: current_kube_proxy_state
  20. retries: 60
  21. delay: 5
  22. until: current_kube_proxy_state is succeeded
  23. changed_when: false
  24. - name: Apply nodeselector patch for kube-proxy daemonset
  25. command: >
  26. {{ kubectl }}
  27. patch ds kube-proxy --namespace=kube-system --type=strategic -p
  28. '{"spec":{"template":{"spec":{"nodeSelector":{"{{ kube_proxy_nodeselector }}":"linux"} }}}}'
  29. register: patch_kube_proxy_state
  30. when: current_kube_proxy_state.stdout | trim | lower != "linux"
  31. - debug: # noqa name[missing]
  32. msg: "{{ patch_kube_proxy_state.stdout_lines }}"
  33. when: patch_kube_proxy_state is not skipped
  34. - debug: # noqa name[missing]
  35. msg: "{{ patch_kube_proxy_state.stderr_lines }}"
  36. when: patch_kube_proxy_state is not skipped