Skip to content

Commit

Permalink
Merge pull request #40 from ChameleonCloud/soufianej-edge-ip-cleanup
Browse files Browse the repository at this point in the history
Fixed detection of unreachable nodes
  • Loading branch information
JOUNAIDSoufiane authored Jan 25, 2024
2 parents 7994839 + 89ee5d4 commit 465bd33
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions hammers/scripts/k8s_calico_ip_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,24 @@ def get_offline_nodes():

nodes = v1.list_node(watch=False)

# Filter nodes based on their status (considered offline if not ready)

offline_nodes = [
node.metadata.name
for node in nodes.items
if (
node.status.conditions is None
or all(
cond.type != "Ready" and cond.status == "Unknown"
node.status.conditions is not None
and all(
cond.status != "True"
for cond in node.status.conditions
if cond.type == "Ready"
)
and any(
taint.effect == "NoExecute" and taint.key == "node.kubernetes.io/unreachable"
for taint in node.spec.taints
)
and any(
taint.effect == "NoSchedule" and taint.key == "node.kubernetes.io/unreachable"
for taint in node.spec.taints
)
)
]
Expand Down

0 comments on commit 465bd33

Please sign in to comment.