diff --git a/src/check_instances_status.py b/src/check_instances_status.py index c843a49..a49f226 100644 --- a/src/check_instances_status.py +++ b/src/check_instances_status.py @@ -146,6 +146,22 @@ def sync_hcp_node_pools(cluster:oc_cluster): if response.status_code == 200: totalNodes += newReplicas print(f'now total nodes are {totalNodes}') + + try: + if cluster.name == 'trustyai-rob': + payload = {'id': id,'labels':{},'taints':[],'replicas': replicas} + response = requests.patch(f'{api_server_base_url}/clusters_mgmt/v1/clusters/{cluster.id}/node_pools/{id}', + data=json.dumps(payload), + headers={'Authorization': f'Bearer {ocm_api_token}', 'Content-Type': 'application/json'}) + + print(f'reset the machine pool {id} with the original replica count {replicas} for cluster {cluster.name}') + print(response.status_code) + if response.status_code == 200: + totalNodes += replicas - newReplicas + print(f'now total nodes are back to {totalNodes}') + except: + print(traceback.format_exc()) + return totalNodes