Skip to content

Commit

Permalink
added hypershift_upstream_installed to check if upstream installed 0.1
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Osypenko <[email protected]>
  • Loading branch information
DanielOsypenko committed Apr 10, 2024
1 parent 28658bc commit caadd89
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
14 changes: 14 additions & 0 deletions ocs_ci/deployment/helpers/hypershift_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,20 @@ def get_mce_version(self):
logger.info(f"Multicluster engine version: {cmd_res.stdout.decode('utf-8')}")
return cmd_res.stdout.decode("utf-8")

def hypershift_upstream_installed(self):
"""
Check if hypershift is installed on the cluster
Returns:
bool: True if hypershift is installed, False otherwise
"""
cmd = "oc get deployments -n hypershift | awk 'NR>1 {print \"true\"; exit}' "
cmd_res = exec_cmd(cmd, shell=True)
if cmd_res.returncode != 0:
logger.error(f"Failed to get hypershift operator version\n{cmd_res.stderr}")
return False

return cmd_res.stdout.decode("utf-8").strip() == "true"

def install_hypershift_upstream_on_cluster(self):
"""
Install hypershift on the cluster
Expand Down
21 changes: 14 additions & 7 deletions ocs_ci/deployment/hosted_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,20 @@ def deploy_dependencies(
)

if provider_ocp_version > latest_released_ocp_version:
try:
self.disable_multicluster_engine()
self.install_hypershift_upstream_on_cluster()
except CommandFailed as e:
raise AssertionError(
f"Failed to install Hypershift on the cluster: {e}"
)
if not self.hypershift_upstream_installed():
try:
self.disable_multicluster_engine()
# avoid timelapse error "
# Error: [serviceaccounts "operator" is forbidden: unable to create new content"
logger.info(
"Sleeping for 5 minutes after disable_multicluster_engine()"
)
time.sleep(5 * 60)
self.install_hypershift_upstream_on_cluster()
except CommandFailed as e:
raise AssertionError(
f"Failed to install Hypershift on the cluster: {e}"
)


class HostedODF(HypershiftHostedOCP):
Expand Down

0 comments on commit caadd89

Please sign in to comment.