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.

39 lines
1.5 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. {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf
  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. shell: >-
  23. {{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf
  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: msg={{ patch_kube_proxy_state.stdout_lines }}
  29. when: patch_kube_proxy_state is not skipped
  30. - debug: msg={{ patch_kube_proxy_state.stderr_lines }}
  31. when: patch_kube_proxy_state is not skipped
  32. tags: init
  33. when:
  34. - not kube_proxy_remove