Do not await K8s delete PVC

pull/310/head
Frostebite 2022-01-30 20:46:29 +00:00
parent 606ee02858
commit 45f2f6254c
3 changed files with 3 additions and 15 deletions

6
dist/index.js vendored
View File

@ -2033,11 +2033,7 @@ class Kubernetes {
defaultSecretsArray) {
return __awaiter(this, void 0, void 0, function* () {
cloud_runner_logger_1.default.log(`deleting PVC`);
const deletePvcPromise = this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
const awaitTimeout = (delay, reason) => new Promise((resolve, reject) => setTimeout(() => (reason === undefined ? resolve() : reject(reason)), delay));
const wrapPromise = (promise, delay, reason) => Promise.race([promise, awaitTimeout(delay, reason)]);
// eslint-disable-next-line unicorn/no-useless-undefined
yield wrapPromise(deletePvcPromise, 15000, undefined);
this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
});
}
static findPodFromJob(kubeClient, jobName, namespace) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -180,15 +180,7 @@ class Kubernetes implements CloudRunnerProviderInterface {
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
) {
CloudRunnerLogger.log(`deleting PVC`);
const deletePvcPromise = this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
const awaitTimeout = (delay, reason) =>
new Promise<void>((resolve, reject) =>
setTimeout(() => (reason === undefined ? resolve() : reject(reason)), delay),
);
const wrapPromise = (promise, delay, reason) => Promise.race([promise, awaitTimeout(delay, reason)]);
// eslint-disable-next-line unicorn/no-useless-undefined
await wrapPromise(deletePvcPromise, 15000, undefined);
this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
}
static async findPodFromJob(kubeClient: CoreV1Api, jobName: string, namespace: string) {
const namespacedPods = await kubeClient.listNamespacedPod(namespace);