test k8s on startup by listing namespaces to confirm kubeclient access

pull/437/head
Frostebite 2022-11-01 21:24:43 +00:00
parent b759bce664
commit 61071092c1
3 changed files with 5 additions and 1 deletions

2
dist/index.js vendored
View File

@ -3034,6 +3034,8 @@ class Kubernetes {
this.secretName = `build-credentials-${this.buildGuid}`; this.secretName = `build-credentials-${this.buildGuid}`;
this.jobName = `unity-builder-job-${this.buildGuid}`; this.jobName = `unity-builder-job-${this.buildGuid}`;
this.containerName = `main`; this.containerName = `main`;
const namespaceListTest = yield this.kubeClient.listNamespace();
cloud_runner_logger_1.default.log(`Init test ${namespaceListTest.body.items.length}`);
yield kubernetes_secret_1.default.createSecret(secrets, this.secretName, this.namespace, this.kubeClient); yield kubernetes_secret_1.default.createSecret(secrets, this.secretName, this.namespace, this.kubeClient);
yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets); yield this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
this.setPodNameAndContainerName(yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace)); this.setPodNameAndContainerName(yield Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -113,6 +113,8 @@ class Kubernetes implements ProviderInterface {
this.secretName = `build-credentials-${this.buildGuid}`; this.secretName = `build-credentials-${this.buildGuid}`;
this.jobName = `unity-builder-job-${this.buildGuid}`; this.jobName = `unity-builder-job-${this.buildGuid}`;
this.containerName = `main`; this.containerName = `main`;
const namespaceListTest = await this.kubeClient.listNamespace();
CloudRunnerLogger.log(`Init test ${namespaceListTest.body.items.length}`);
await KubernetesSecret.createSecret(secrets, this.secretName, this.namespace, this.kubeClient); await KubernetesSecret.createSecret(secrets, this.secretName, this.namespace, this.kubeClient);
await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets); await this.createNamespacedJob(commands, image, mountdir, workingdir, environment, secrets);
this.setPodNameAndContainerName(await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace)); this.setPodNameAndContainerName(await Kubernetes.findPodFromJob(this.kubeClient, this.jobName, this.namespace));