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. block:
  10. # Due to https://github.com/kubernetes/kubernetes/issues/58212 we cannot rely on exit code for "kubectl patch"
  11. - name: Check current nodeselector for kube-proxy daemonset
  12. command: >-
  13. {{ kubectl }}
  14. get ds kube-proxy --namespace=kube-system
  15. -o jsonpath={.spec.template.spec.nodeSelector.{{ kube_proxy_nodeselector | regex_replace('\.', '\\.') }}}
  16. register: current_kube_proxy_state
  17. retries: 60
  18. delay: 5
  19. until: current_kube_proxy_state is succeeded
  20. changed_when: false
  21. - name: Apply nodeselector patch for kube-proxy daemonset
  22. command: >
  23. {{ kubectl }}
  24. patch ds kube-proxy --namespace=kube-system --type=strategic -p
  25. '{"spec":{"template":{"spec":{"nodeSelector":{"{{ kube_proxy_nodeselector }}":"linux"} }}}}'
  26. register: patch_kube_proxy_state
  27. when: current_kube_proxy_state.stdout | trim | lower != "linux"
  28. - debug: # noqa unnamed-task
  29. msg: "{{ patch_kube_proxy_state.stdout_lines }}"
  30. when: patch_kube_proxy_state is not skipped
  31. - debug: # noqa unnamed-task
  32. msg: "{{ patch_kube_proxy_state.stderr_lines }}"
  33. when: patch_kube_proxy_state is not skipped
  34. tags: init
  35. when:
  36. - kube_proxy_deployed