Skip to content
Snippets Groups Projects
Unverified Commit dba00f2d authored by Max Gautier's avatar Max Gautier
Browse files

metrics-server: Unconditional control-plane tolerations

There is no harm on having unneeded toleration when control-plane node
are not tainted, so simplify the template to always use the toleration.
parent 9f455522
No related branches found
No related tags found
No related merge requests found
--- ---
# If all control plane nodes have the node role, there are no tainted control plane nodes and toleration should not be specified.
- name: Check all control plane nodes are node or not
set_fact:
control_plane_nodes_are_not_tainted: "{{ groups['kube_node'] | intersect(groups['kube_control_plane']) == groups['kube_control_plane'] }}"
- name: Metrics Server | Delete addon dir - name: Metrics Server | Delete addon dir
file: file:
path: "{{ kube_config_dir }}/addons/metrics_server" path: "{{ kube_config_dir }}/addons/metrics_server"
......
...@@ -85,15 +85,11 @@ spec: ...@@ -85,15 +85,11 @@ spec:
volumes: volumes:
- name: tmp - name: tmp
emptyDir: {} emptyDir: {}
{% if not control_plane_nodes_are_not_tainted or metrics_server_extra_tolerations is defined %}
tolerations: tolerations:
{% if not control_plane_nodes_are_not_tainted %}
- key: node-role.kubernetes.io/control-plane - key: node-role.kubernetes.io/control-plane
effect: NoSchedule effect: NoSchedule
{% endif %}
{% if metrics_server_extra_tolerations is defined %} {% if metrics_server_extra_tolerations is defined %}
{{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }} {{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
{% endif %}
{% endif %} {% endif %}
affinity: affinity:
podAntiAffinity: podAntiAffinity:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment