Fix: log all pvc info
parent
9fb09da753
commit
b9cf74b2e6
|
|
@ -1720,7 +1720,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const async_wait_until_1 = __importDefault(__webpack_require__(41299));
|
const async_wait_until_1 = __importDefault(__webpack_require__(41299));
|
||||||
const core = __importStar(__webpack_require__(42186));
|
const core = __importStar(__webpack_require__(42186));
|
||||||
const k8s = __importStar(__webpack_require__(89679));
|
const k8s = __importStar(__webpack_require__(89679));
|
||||||
const assert_1 = __webpack_require__(42357);
|
|
||||||
class KubernetesStorage {
|
class KubernetesStorage {
|
||||||
static getPVCPhase(kubeClient, name, namespace) {
|
static getPVCPhase(kubeClient, name, namespace) {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -1730,6 +1729,7 @@ class KubernetesStorage {
|
||||||
}
|
}
|
||||||
static watchUntilPVCNotPending(kubeClient, name, namespace) {
|
static watchUntilPVCNotPending(kubeClient, name, namespace) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
|
||||||
yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { return (yield this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending'; }), {
|
yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { return (yield this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending'; }), {
|
||||||
timeout: 500000,
|
timeout: 500000,
|
||||||
intervalBetweenAttempts: 15000,
|
intervalBetweenAttempts: 15000,
|
||||||
|
|
@ -1737,7 +1737,7 @@ class KubernetesStorage {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static createPersistentVolumeClaim(buildParameters, pvcName, kubeClient, namespace) {
|
static createPersistentVolumeClaim(buildParameters, pvcName, kubeClient, namespace) {
|
||||||
var _a, _b;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (buildParameters.kubeVolume) {
|
if (buildParameters.kubeVolume) {
|
||||||
core.info(buildParameters.kubeVolume);
|
core.info(buildParameters.kubeVolume);
|
||||||
|
|
@ -1760,8 +1760,7 @@ class KubernetesStorage {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const result = yield kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
const result = yield kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
||||||
core.info(`Persistent Volume Claim ${(_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name} created`);
|
core.info(`Persistent Volume Claim ${(_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name} ${pvcName} created`);
|
||||||
assert_1.strict.strictEqual((_b = result.body.metadata) === null || _b === void 0 ? void 0 : _b.name, pvcName);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -2,13 +2,13 @@ import waitUntil from 'async-wait-until';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as k8s from '@kubernetes/client-node';
|
import * as k8s from '@kubernetes/client-node';
|
||||||
import BuildParameters from '../build-parameters';
|
import BuildParameters from '../build-parameters';
|
||||||
import { strict as assert } from 'assert';
|
|
||||||
|
|
||||||
class KubernetesStorage {
|
class KubernetesStorage {
|
||||||
public static async getPVCPhase(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
public static async getPVCPhase(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||||
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
|
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
|
||||||
}
|
}
|
||||||
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||||
|
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
|
||||||
await waitUntil(async () => (await this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending', {
|
await waitUntil(async () => (await this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending', {
|
||||||
timeout: 500000,
|
timeout: 500000,
|
||||||
intervalBetweenAttempts: 15000,
|
intervalBetweenAttempts: 15000,
|
||||||
|
|
@ -42,8 +42,7 @@ class KubernetesStorage {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
||||||
core.info(`Persistent Volume Claim ${result.body.metadata?.name} created`);
|
core.info(`Persistent Volume Claim ${result.body.metadata?.name} ${pvcName} created`);
|
||||||
assert.strictEqual(result.body.metadata?.name, pvcName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue