Skip to content

Commit

Permalink
Fix retry logic for deploying operators (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwinIsland authored Mar 1, 2024
1 parent ab6873a commit 3627346
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions acto/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3627346

Please sign in to comment.