diff --git a/acto/engine.py b/acto/engine.py index 5f963fee35..5ad5021346 100644 --- a/acto/engine.py +++ b/acto/engine.py @@ -933,24 +933,24 @@ def __learn(self, context_file, helper_crd, analysis_only=False): os.path.expanduser("~"), ".kube", learn_context_name ) - while True: - self.cluster.restart_cluster("learn", learn_kubeconfig) - namespace = ( - get_yaml_existing_namespace(self.deploy.operator_yaml) - or CONST.ACTO_NAMESPACE - ) - self.context["namespace"] = namespace - kubectl_client = KubectlClient( - learn_kubeconfig, learn_context_name - ) - deployed = self.deploy.deploy_with_retry( - learn_kubeconfig, - learn_context_name, - kubectl_client=kubectl_client, - namespace=namespace, + self.cluster.restart_cluster("learn", learn_kubeconfig) + namespace = ( + get_yaml_existing_namespace(self.deploy.operator_yaml) + or CONST.ACTO_NAMESPACE + ) + self.context["namespace"] = namespace + kubectl_client = KubectlClient(learn_kubeconfig, learn_context_name) + deployed = self.deploy.deploy_with_retry( + learn_kubeconfig, + learn_context_name, + kubectl_client=kubectl_client, + namespace=namespace, + ) + if not deployed: + raise RuntimeError( + f"Failed to deploy operator due to max retry exceed" ) - if deployed: - break + apiclient = kubernetes_client(learn_kubeconfig, learn_context_name) logger.debug("helper crd path is %s", helper_crd) self.context["crd"] = process_crd(