Improve k8s logging accuracy

pull/496/head
Frostebite 2023-02-03 00:49:19 +00:00
parent 0412b98708
commit aa18edc853
3 changed files with 9 additions and 1 deletions

2
dist/index.js generated vendored
View File

@ -3310,6 +3310,8 @@ class Kubernetes {
try { try {
const existsAlready = yield this.doesJobExist(this.jobName); const existsAlready = yield this.doesJobExist(this.jobName);
const existsFailedAlready = yield this.doesFailedJobExist(); const existsFailedAlready = yield this.doesFailedJobExist();
cloud_runner_logger_1.default.log(JSON.stringify(yield this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace), undefined, 4));
cloud_runner_logger_1.default.log(JSON.stringify(yield this.kubeClient.readNamespacedPod(this.podName, this.namespace), undefined, 4));
if (!existsAlready || existsFailedAlready) { if (!existsAlready || existsFailedAlready) {
cloud_runner_logger_1.default.log('Job does not exist'); cloud_runner_logger_1.default.log('Job does not exist');
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets); yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -135,6 +135,12 @@ class Kubernetes implements ProviderInterface {
try { try {
const existsAlready = await this.doesJobExist(this.jobName); const existsAlready = await this.doesJobExist(this.jobName);
const existsFailedAlready = await this.doesFailedJobExist(); const existsFailedAlready = await this.doesFailedJobExist();
CloudRunnerLogger.log(
JSON.stringify(await this.kubeClient.readNamespacedPodStatus(this.podName, this.namespace), undefined, 4),
);
CloudRunnerLogger.log(
JSON.stringify(await this.kubeClient.readNamespacedPod(this.podName, this.namespace), undefined, 4),
);
if (!existsAlready || existsFailedAlready) { if (!existsAlready || existsFailedAlready) {
CloudRunnerLogger.log('Job does not exist'); CloudRunnerLogger.log('Job does not exist');
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets); await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);