Skip to content

Commit

Permalink
including pre flight checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mukrishn committed Nov 1, 2023
1 parent ec2f96c commit bb85fc8
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions libs/platforms/rosa/terraform/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ def delete_cluster(self, platform, cluster_name):
cluster_info["total_count"] = platform.environment['cluster_count']
self.logging.info(f"Checking uninstall log for cluster {cluster_name}")

while retry_loop <= 3600: # 2hr timeout
while retry_loop <= 600: # 1hr timeout
retry_loop += 1
cluster_delete_start_time = int(datetime.datetime.utcnow().timestamp())
watch_code, watch_out, watch_err = self.utils.subprocess_exec("rosa logs uninstall -c " + cluster_name + " --watch", cluster_info["path"] + "/cleanup.log", {'preexec_fn': self.utils.disable_signals})
if watch_code != 0:
if retry_loop <= 3600:
self.logging.debug(f"ROSA cluster {cluster_name} is not available yet, retrying..")
if retry_loop <= 600:
self.logging.debug(f"ROSA cluster uninstall log for {cluster_name} is not available yet, retrying..")
self.logging.debug(watch_out)
time.sleep(5)
time.sleep(6)
else:
cluster_info['status'] = "not deleted"
self.logging.debug(watch_out)
Expand Down Expand Up @@ -319,22 +319,26 @@ def create_cluster(self, platform, cluster_name):
os.mkdir(cluster_info["path"])
self.logging.debug("Output directory set to %s" % cluster_info["path"])

while retry_loop <= 7200: # 2hr timeout
while retry_loop <= 1800: # 1hr timeout
retry_loop += 1
cluster_start_time = int(datetime.datetime.utcnow().timestamp())
watch_code, watch_out, watch_err = self.utils.subprocess_exec("rosa logs install -c " + cluster_name + " --watch", cluster_info["path"] + "/installation.log", {'preexec_fn': self.utils.disable_signals})
if watch_code != 0:
if retry_loop <= 7200:
status_code, status_out, status_err = self.utils.subprocess_exec("rosa describe cluster -c " + cluster_name + " -o json", extra_params={"universal_newlines": True})
if status_code != 0:
if retry_loop <= 1800:
self.logging.debug(f"ROSA cluster {cluster_name} is not available yet, retrying..")
self.logging.debug(watch_out)
time.sleep(5)
self.logging.debug(status_out)
time.sleep(2)
else:
cluster_info['status'] = "not ready"
self.logging.debug(watch_out)
self.logging.error(watch_err)
return 1
else:
preflight_ch = self._preflight_wait(cluster_name, cluster_name)
cluster_info["preflight_checks"] = preflight_ch.result()
break

watch_code, watch_out, watch_err = self.utils.subprocess_exec("rosa logs install -c " + cluster_name + " --watch", cluster_info["path"] + "/installation.log", {'preexec_fn': self.utils.disable_signals})
cluster_info['status'] = "installed"
cluster_end_time = int(datetime.datetime.utcnow().timestamp())
# Getting againg metadata to update the cluster status
Expand Down

0 comments on commit bb85fc8

Please sign in to comment.