Log PVC state
parent
dcb6b5241c
commit
adf74e9bde
|
|
@ -1537,7 +1537,7 @@ class Kubernetes {
|
||||||
core.info('Creating build job');
|
core.info('Creating build job');
|
||||||
yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
||||||
core.info('Job created');
|
core.info('Job created');
|
||||||
yield kubernetes_storage_1.default.watchPersistentVolumeClaimUntilBoundToContainer(this.kubeClient, this.pvcName, this.namespace);
|
yield kubernetes_storage_1.default.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
||||||
core.info('PVC Bound');
|
core.info('PVC Bound');
|
||||||
this.setPodNameAndContainerName(yield this.getPod());
|
this.setPodNameAndContainerName(yield this.getPod());
|
||||||
core.info('Watching pod and streaming logs');
|
core.info('Watching pod and streaming logs');
|
||||||
|
|
@ -1727,7 +1727,7 @@ class KubernetesStorage {
|
||||||
return (_a = (yield kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status) === null || _a === void 0 ? void 0 : _a.phase;
|
return (_a = (yield kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status) === null || _a === void 0 ? void 0 : _a.phase;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static watchPersistentVolumeClaimUntilBoundToContainer(kubeClient, name, namespace) {
|
static watchUntilPVCNotPending(kubeClient, name, namespace) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
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,
|
||||||
|
|
@ -1736,6 +1736,7 @@ class KubernetesStorage {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static createPersistentVolumeClaim(buildParameters, pvcName, kubeClient, namespace) {
|
static createPersistentVolumeClaim(buildParameters, pvcName, kubeClient, namespace) {
|
||||||
|
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);
|
||||||
|
|
@ -1757,9 +1758,8 @@ class KubernetesStorage {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
yield kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
const result = yield kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
||||||
core.info(`Persistent Volume Claim created`);
|
core.info(`Persistent Volume Claim ${(_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name} created`);
|
||||||
core.info(`PVC state: ${yield this.getPVCPhase(kubeClient, pvcName, namespace)}`);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -318,11 +318,7 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
core.info('Creating build job');
|
core.info('Creating build job');
|
||||||
await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
||||||
core.info('Job created');
|
core.info('Job created');
|
||||||
await KubernetesStorage.watchPersistentVolumeClaimUntilBoundToContainer(
|
await KubernetesStorage.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
||||||
this.kubeClient,
|
|
||||||
this.pvcName,
|
|
||||||
this.namespace,
|
|
||||||
);
|
|
||||||
core.info('PVC Bound');
|
core.info('PVC Bound');
|
||||||
this.setPodNameAndContainerName(await this.getPod());
|
this.setPodNameAndContainerName(await this.getPod());
|
||||||
core.info('Watching pod and streaming logs');
|
core.info('Watching pod and streaming logs');
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,7 @@ 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 watchPersistentVolumeClaimUntilBoundToContainer(
|
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||||
kubeClient: k8s.CoreV1Api,
|
|
||||||
name: string,
|
|
||||||
namespace: string,
|
|
||||||
) {
|
|
||||||
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,
|
||||||
|
|
@ -44,9 +40,8 @@ class KubernetesStorage {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
|
||||||
core.info(`Persistent Volume Claim created`);
|
core.info(`Persistent Volume Claim ${result.body.metadata?.name} created`);
|
||||||
core.info(`PVC state: ${await this.getPVCPhase(kubeClient, pvcName, namespace)}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue