Skip to content

Commit

Permalink
metrics-server: Unconditional control-plane tolerations
Browse files Browse the repository at this point in the history
There is no harm on having unneeded toleration when control-plane node
are not tainted, so simplify the template to always use the toleration.
  • Loading branch information
VannTen committed Sep 24, 2024
1 parent 9f45552 commit dba00f2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
5 changes: 0 additions & 5 deletions roles/kubernetes-apps/metrics_server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
---
# 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
file:
path: "{{ kube_config_dir }}/addons/metrics_server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ spec:
volumes:
- name: tmp
emptyDir: {}
{% if not control_plane_nodes_are_not_tainted or metrics_server_extra_tolerations is defined %}
tolerations:
{% if not control_plane_nodes_are_not_tainted %}
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
{% endif %}
{% if metrics_server_extra_tolerations is defined %}
{{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
{% endif %}
{% endif %}
affinity:
podAntiAffinity:
Expand Down

0 comments on commit dba00f2

Please sign in to comment.