Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waiting ready condition #1899

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions javascript/packages/orchestrator/src/providers/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export abstract class Client {
keystore?: string,
chainSpecId?: string,
dbSnapshot?: string, //delay?: DelayNetworkSettings,
longRunning?: boolean,
): Promise<void>;
abstract copyFileFromPod(
identifier: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export class KubeClient extends Client {
keystore?: string,
chainSpecId?: string,
dbSnapshot?: string,
longRunning?: boolean,
): Promise<void> {
const name = podDef.metadata.name;
writeLocalJsonFile(this.tmpDir, `${name}.json`, podDef);
Expand Down Expand Up @@ -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],
});
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions javascript/packages/orchestrator/src/spawner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading