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 Oct 24, 2024
2 parents 8c2131b + d92a698 commit 9db954e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/resume_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import cluster_aggregator as ca
import smartsheet, requests
import re
import traceback

class oc_cluster:
def __init__(self, cluster_detail, ocm_account):
Expand Down Expand Up @@ -126,6 +127,22 @@ def sync_hcp_node_pools(cluster:oc_cluster):
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())


time.sleep(30)
return totalNodes

Expand Down

0 comments on commit 9db954e

Please sign in to comment.