Skip to content

Commit

Permalink
Fixing paasta clean up stale nodes (#3971)
Browse files Browse the repository at this point in the history
* Fixing paasta clean up stale nodes

* Fixing paasta clean up stale nodes
  • Loading branch information
wilmer05 authored Sep 25, 2024
1 parent 71cfbaf commit baec7b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions example_cluster/dind-cluster-v1.13.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@ spec:
- key: CriticalAddonsOnly
operator: Exists
- effect: NoSchedule
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
operator: Exists
volumes:
- name: lib-modules
Expand Down Expand Up @@ -1819,7 +1819,7 @@ function dind::up {
else
# FIXME: this may fail depending on k8s/kubeadm version
# FIXME: check for taint & retry if it's there
"${kubectl}" --context "$ctx" taint nodes $(dind::master-name) node-role.kubernetes.io/master- || true
"${kubectl}" --context "$ctx" taint nodes $(dind::master-name) node-role.kubernetes.io/control-plane- || true
fi
case "${CNI_PLUGIN}" in
bridge | ptp)
Expand Down
2 changes: 1 addition & 1 deletion paasta_tools/kubernetes/bin/paasta_cleanup_stale_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def nodes_for_cleanup(ec2_client: Client, nodes: Sequence[V1Node]) -> List[V1Nod
node
for node in nodes
if not is_node_ready(node)
and "node-role.kubernetes.io/master" not in node.metadata.labels
and "node-role.kubernetes.io/control-plane" not in node.metadata.labels
]
terminated = terminated_nodes(ec2_client, not_ready)
return terminated
Expand Down
4 changes: 2 additions & 2 deletions tests/kubernetes/bin/test_paasta_cleanup_stale_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_nodes_for_cleanup():
) as mock_terminated_nodes:
m1, m2, m3 = mock.MagicMock(), mock.MagicMock(), mock.MagicMock()
m4 = mock.MagicMock()
m4.metadata.labels = {"node-role.kubernetes.io/master": ""}
m4.metadata.labels = {"node-role.kubernetes.io/control-plane": ""}
mock_ec2_client = mock.Mock()
mock_terminated_nodes.return_value = [m2, m3]
for_cleanup = nodes_for_cleanup(mock_ec2_client, [m1, m2, m3, m4])
Expand Down Expand Up @@ -133,7 +133,7 @@ def test_main():
else:
m.metadata.labels = {
"failure-domain.beta.kubernetes.io/region": "us-west-1",
"node-role.kubernetes.io/master": "",
"node-role.kubernetes.io/control-plane": "",
}

mock_get_all_nodes.return_value = [m1, m2, m3, m4]
Expand Down

0 comments on commit baec7b8

Please sign in to comment.