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.

36 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. - name: Copy kube-proxy daemonset nodeselector patch
  11. copy:
  12. src: nodeselector-os-linux-patch.json
  13. dest: "{{ kubernetes_user_manifests_path }}/nodeselector-os-linux-patch.json"
  14. # Due to https://github.com/kubernetes/kubernetes/issues/58212 we cannot rely on exit code for "kubectl patch"
  15. - name: Check current nodeselector for kube-proxy daemonset
  16. shell: "{{bin_dir}}/kubectl get ds kube-proxy --namespace=kube-system -o jsonpath='{.spec.template.spec.nodeSelector.beta.kubernetes.io/os}'"
  17. register: current_kube_proxy_state
  18. - name: Apply nodeselector patch for kube-proxy daemonset
  19. shell: "{{bin_dir}}/kubectl patch ds kube-proxy --namespace=kube-system --type=strategic -p \"$(cat nodeselector-os-linux-patch.json)\""
  20. args:
  21. chdir: "{{ kubernetes_user_manifests_path }}"
  22. register: patch_kube_proxy_state
  23. when: current_kube_proxy_state.stdout | trim | lower != "linux"
  24. - debug: msg={{ patch_kube_proxy_state.stdout_lines }}
  25. when: patch_kube_proxy_state is not skipped
  26. - debug: msg={{ patch_kube_proxy_state.stderr_lines }}
  27. when: patch_kube_proxy_state is not skipped
  28. tags: init
  29. when:
  30. - not kube_proxy_remove