Skip to content

Commit

Permalink
Merge branch 'dchourasia:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dchourasia authored Nov 4, 2024
2 parents fc8b402 + 343a7ff commit 21eb53d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/check_instances_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 21eb53d

Please sign in to comment.