Do not await K8s delete PVC
parent
606ee02858
commit
45f2f6254c
|
|
@ -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) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue