diff --git a/javascript/packages/orchestrator/src/providers/client.ts b/javascript/packages/orchestrator/src/providers/client.ts index 94785c963..70c0a364a 100644 --- a/javascript/packages/orchestrator/src/providers/client.ts +++ b/javascript/packages/orchestrator/src/providers/client.ts @@ -74,6 +74,7 @@ export abstract class Client { keystore?: string, chainSpecId?: string, dbSnapshot?: string, //delay?: DelayNetworkSettings, + longRunning?: boolean, ): Promise; abstract copyFileFromPod( identifier: string, diff --git a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts index 923721b62..cecb69ed4 100644 --- a/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts +++ b/javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts @@ -121,6 +121,7 @@ export class KubeClient extends Client { keystore?: string, chainSpecId?: string, dbSnapshot?: string, + longRunning?: boolean, ): Promise { const name = podDef.metadata.name; writeLocalJsonFile(this.tmpDir, `${name}.json`, podDef); @@ -230,6 +231,9 @@ export class KubeClient extends Client { await this.putLocalMagicFile(name); await this.waitPodReady(name); + if (longRunning) + await this.runCommand(["wait", "--for=condition=Ready", `Pod/${name}`]); + logTable = new CreateLogTable({ colWidths: [20, 100], }); @@ -566,13 +570,18 @@ export class KubeClient extends Client { }); debug("waiting for pod: fileserver, to be ready"); await this.waitPodReady("fileserver"); + await this.runCommand(["wait", "--for=condition=Ready", "Pod/fileserver"]); debug("pod: fileserver, ready"); let fileServerOk = false; let attempts = 0; // try 5 times at most for (attempts; attempts < 5; attempts++) { - if (await this.checkFileServer()) fileServerOk = true; - else sleep(1 * 1000); + if (await this.checkFileServer()) { + fileServerOk = true; + break; // ready to go! + } else { + sleep(1 * 1000); + } } if (!fileServerOk) diff --git a/javascript/packages/orchestrator/src/spawner.ts b/javascript/packages/orchestrator/src/spawner.ts index 449795f75..1d4cc7125 100644 --- a/javascript/packages/orchestrator/src/spawner.ts +++ b/javascript/packages/orchestrator/src/spawner.ts @@ -106,6 +106,7 @@ export const spawnNode = async ( keystoreLocalDir, parachainSpecId || network.chainId, node.dbSnapshot, + true, // long running ); const [nodeIp, nodePort] = await client.getNodeInfo(podDef.metadata.name);