fix logstream error k8s
parent
4eaa57bb3a
commit
d570e8bac6
|
|
@ -3057,7 +3057,7 @@ class Kubernetes {
|
|||
});
|
||||
}
|
||||
runTaskInWorkflow(buildGuid, image, commands, mountdir, workingdir, environment, secrets) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
cloud_runner_logger_1.default.log('Cloud Runner K8s workflow!');
|
||||
|
|
@ -3080,7 +3080,7 @@ class Kubernetes {
|
|||
const pods = (yield this.kubeClient.listNamespacedPod(this.namespace)).body.items.filter((x) => { var _a; return this.podName === ((_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name); });
|
||||
const running = pods.length > 0 && (((_a = pods[0].status) === null || _a === void 0 ? void 0 : _a.phase) === `Running` || ((_b = pods[0].status) === null || _b === void 0 ? void 0 : _b.phase) === `Pending`);
|
||||
if (!running) {
|
||||
cloud_runner_logger_1.default.log('Pod not found, assumed ended!');
|
||||
cloud_runner_logger_1.default.log(`Pod not found, assumed ended! ${((_c = pods[0].status) === null || _c === void 0 ? void 0 : _c.phase) || 'undefined status'}`);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
|
@ -3088,7 +3088,7 @@ class Kubernetes {
|
|||
}
|
||||
}
|
||||
catch (error) {
|
||||
const reason = ((_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.reason) || ``;
|
||||
const reason = ((_e = (_d = error.response) === null || _d === void 0 ? void 0 : _d.body) === null || _e === void 0 ? void 0 : _e.reason) || ``;
|
||||
if (reason === `NotFound`) {
|
||||
cloud_runner_logger_1.default.log('Log Stream Container Not Found');
|
||||
yield new Promise((resolve) => resolve(5000));
|
||||
|
|
@ -3143,8 +3143,9 @@ class Kubernetes {
|
|||
yield this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
|
||||
}
|
||||
catch (error) {
|
||||
cloud_runner_logger_1.default.log(`Failed to cleanup`);
|
||||
if (error.response.body.reason !== `NotFound`) {
|
||||
cloud_runner_logger_1.default.log(`Failed to cleanup, error: ${error.response.body.reason}`);
|
||||
cloud_runner_logger_1.default.log(`Wasn't a not found error: ${error.response.body.reason}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
@ -3152,7 +3153,8 @@ class Kubernetes {
|
|||
yield this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace);
|
||||
}
|
||||
catch (error) {
|
||||
cloud_runner_logger_1.default.log(`Failed to cleanup secret, error: ${error.response.body.reason}`);
|
||||
cloud_runner_logger_1.default.log(`Failed to cleanup secret`);
|
||||
cloud_runner_logger_1.default.log(error.response.body.reason);
|
||||
}
|
||||
cloud_runner_logger_1.default.log('cleaned up Secret, Job and Pod');
|
||||
cloud_runner_logger_1.default.log('cleaning up finished');
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -156,7 +156,7 @@ class Kubernetes implements ProviderInterface {
|
|||
pods.length > 0 && (pods[0].status?.phase === `Running` || pods[0].status?.phase === `Pending`);
|
||||
|
||||
if (!running) {
|
||||
CloudRunnerLogger.log('Pod not found, assumed ended!');
|
||||
CloudRunnerLogger.log(`Pod not found, assumed ended! ${pods[0].status?.phase || 'undefined status'}`);
|
||||
break;
|
||||
} else {
|
||||
CloudRunnerLogger.log('Pod still running, recovering stream...');
|
||||
|
|
@ -233,15 +233,17 @@ class Kubernetes implements ProviderInterface {
|
|||
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
||||
await this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
|
||||
} catch (error: any) {
|
||||
CloudRunnerLogger.log(`Failed to cleanup`);
|
||||
if (error.response.body.reason !== `NotFound`) {
|
||||
CloudRunnerLogger.log(`Failed to cleanup, error: ${error.response.body.reason}`);
|
||||
CloudRunnerLogger.log(`Wasn't a not found error: ${error.response.body.reason}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
try {
|
||||
await this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace);
|
||||
} catch (error: any) {
|
||||
CloudRunnerLogger.log(`Failed to cleanup secret, error: ${error.response.body.reason}`);
|
||||
CloudRunnerLogger.log(`Failed to cleanup secret`);
|
||||
CloudRunnerLogger.log(error.response.body.reason);
|
||||
}
|
||||
CloudRunnerLogger.log('cleaned up Secret, Job and Pod');
|
||||
CloudRunnerLogger.log('cleaning up finished');
|
||||
|
|
|
|||
Loading…
Reference in New Issue