Skip to content

Commit

Permalink
Merge pull request #4 from ckhordiasma/hibernate-tshoot
Browse files Browse the repository at this point in the history
logs for clusters that were not hibernated
  • Loading branch information
ckhordiasma authored Nov 1, 2024
2 parents 43c33b1 + 33fd561 commit fc8b402
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hibernate_clusters_daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def main():
smartsheet_cluster_info = smartsheet_data[cluster.id]

if not smartsheet_cluster_info[0]:
print(f'Time not found for {cluster.name}')
print(f'Start time not found for {cluster.name}')
continue
if smartsheet_cluster_info[0].count(':') < 1:
print(f'Invalid inactive_hours_start {smartsheet_cluster_info[0]} for cluster {cluster.name}')
Expand All @@ -233,10 +233,10 @@ def main():
cluster.inactive_hours_start = smartsheet_cluster_info[0]

hibernated_clusters = []

no_action_clusters = []

for cluster in clusters:

if cluster.inactive_hours_start and good_time_to_hibernate_cluster(cluster.inactive_hours_start):
if cluster.hcp == "false":
if cluster.type == 'ocp':
Expand All @@ -249,10 +249,14 @@ def main():
hybernate_hypershift_cluster(cluster, ec2_instances[cluster.region])
print("Hibernating Hypershift Cluster - ", cluster.name)
hibernated_clusters.append(cluster.__dict__)
else:
no_action_clusters.append(cluster.__dict__)

print("The following clusters were hibernated: ")
print(json.dumps(hibernated_clusters, indent=4))

print("No action taken for the following cluster:")
print(json.dumps(no_action_clusters, indent=4))

if __name__ == '__main__':
main()

0 comments on commit fc8b402

Please sign in to comment.