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.

57 lines
2.2 KiB

  1. ---
  2. # If all masters have node role, there are no tainted master and toleration should not be specified.
  3. - name: Check all masters are node or not
  4. set_fact:
  5. masters_are_not_tainted: "{{ groups['kube-node'] | intersect(groups['kube-master']) == groups['kube-master'] }}"
  6. - name: Metrics Server | Delete addon dir
  7. file:
  8. path: "{{ kube_config_dir }}/addons/metrics_server"
  9. state: absent
  10. when:
  11. - inventory_hostname == groups['kube-master'][0]
  12. tags:
  13. - upgrade
  14. - name: Metrics Server | Create addon dir
  15. file:
  16. path: "{{ kube_config_dir }}/addons/metrics_server"
  17. state: directory
  18. owner: root
  19. group: root
  20. mode: 0755
  21. when:
  22. - inventory_hostname == groups['kube-master'][0]
  23. - name: Metrics Server | Templates list
  24. set_fact:
  25. metrics_server_templates:
  26. - { name: auth-delegator, file: auth-delegator.yaml, type: clusterrolebinding }
  27. - { name: auth-reader, file: auth-reader.yaml, type: rolebinding }
  28. - { name: metrics-server-cm, file: metrics-server-cm.yaml, type: cm }
  29. - { name: metrics-server-sa, file: metrics-server-sa.yaml, type: sa }
  30. - { name: metrics-server-deployment, file: metrics-server-deployment.yaml, type: deploy }
  31. - { name: metrics-server-service, file: metrics-server-service.yaml, type: service }
  32. - { name: metrics-apiservice, file: metrics-apiservice.yaml, type: service }
  33. - { name: resource-reader-clusterrolebinding, file: resource-reader-clusterrolebinding.yaml, type: clusterrolebinding }
  34. - { name: resource-reader, file: resource-reader.yaml, type: clusterrole }
  35. - name: Metrics Server | Create manifests
  36. template:
  37. src: "{{ item.file }}.j2"
  38. dest: "{{ kube_config_dir }}/addons/metrics_server/{{ item.file }}"
  39. with_items: "{{ metrics_server_templates }}"
  40. register: metrics_server_manifests
  41. when:
  42. - inventory_hostname == groups['kube-master'][0]
  43. - name: Metrics Server | Apply manifests
  44. kube:
  45. name: "{{ item.item.name }}"
  46. kubectl: "{{ bin_dir }}/kubectl"
  47. resource: "{{ item.item.type }}"
  48. filename: "{{ kube_config_dir }}/addons/metrics_server/{{ item.item.file }}"
  49. state: "latest"
  50. with_items: "{{ metrics_server_manifests.results }}"
  51. when:
  52. - inventory_hostname == groups['kube-master'][0]