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

fix(orchestrator): add probe to manifest and remove sleep in code #1563

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,14 @@
}
}

// wait until fileserver is ready, fix race condition #700.
const xinfra = process.env.X_INFRA_INSTANCE || "ondemand";
debug("creating fileserver");
await this.createStaticResource("fileserver-pod.yaml", this.namespace, {
xinfra,
});
debug("waiting for pod: fileserver, to be ready");
await this.waitPodReady("fileserver");
sleep(3 * 1000);
debug("pod: fileserver, ready");
let fileServerOk = false;
let attempts = 0;
// try 5 times at most
Expand All @@ -584,7 +585,7 @@
async checkFileServer(): Promise<boolean> {
const args = ["exec", "Pod/fileserver", "--", "curl", `http://localhost/`];
debug("checking fileserver", args);
const result = await this.runCommand(args);
const result = await this.runCommand(args, { allowFail: true } );

Check failure on line 588 in javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Delete `·`

Check failure on line 588 in javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts

View workflow job for this annotation

GitHub Actions / build (19.x)

Delete `·`

Check failure on line 588 in javascript/packages/orchestrator/src/providers/k8s/kubeClient.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Delete `·`
debug("result", result);
return result.stdout.includes("Welcome to nginx");
}
Expand Down Expand Up @@ -765,9 +766,17 @@
exitCode: result.exitCode,
stdout: result.stdout,
};
} catch (error) {
} catch (error: any) {
debug(error);
throw error;
if (!opts?.allowFail) throw error;

const { exitCode, stdout, message: errorMsg } = error;

return {
exitCode,
stdout,
errorMsg,
};
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@
{
"containerPort": 80
}
]
],
"startupProbe": {
"httpGet": {
"path": "/",
"port": 80
},
"initialDelaySeconds": 5,
"periodSeconds": 3,
"failureThreshold": 15
}
}
],
"restartPolicy": "OnFailure",
Expand Down
Loading