in modules/python/csi/csi.py [0:0]
def validate_node_count(node_label, node_count, operation_timeout_in_minutes):
kube_client = KubernetesClient()
ready_node_count = 0
timeout = time.time() + (operation_timeout_in_minutes * 60)
print(f"Validating {node_count} nodes with label {node_label} are ready.")
while time.time() < timeout:
ready_nodes = kube_client.get_ready_nodes(label_selector=node_label)
ready_node_count = len(ready_nodes)
print(f"Currently {ready_node_count} nodes are ready.")
if ready_node_count == node_count:
break
print(f"Waiting for {node_count} nodes to be ready.")
time.sleep(10)
if ready_node_count != node_count:
raise Exception(f"Only {ready_node_count} nodes are ready, expected {node_count} nodes!")