Always try and deploy rook for k8s

pull/353/head
Frostebite 2022-03-09 21:47:53 +00:00
parent 5e53df432d
commit 1814ab4f64
3 changed files with 19 additions and 1 deletions

9
dist/index.js vendored
View File

@ -1916,6 +1916,7 @@ const async_wait_until_1 = __importDefault(__nccwpck_require__(41299));
const kubernetes_job_spec_factory_1 = __importDefault(__nccwpck_require__(1739));
const kubernetes_service_account_1 = __importDefault(__nccwpck_require__(42915));
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
const cloud_runner_system_1 = __nccwpck_require__(66879);
class Kubernetes {
constructor(buildParameters) {
this.buildGuid = '';
@ -1944,6 +1945,14 @@ class Kubernetes {
this.pvcName = `unity-builder-pvc-${buildGuid}`;
this.cleanupCronJobName = `unity-builder-cronjob-${buildGuid}`;
this.serviceAccountName = `service-account-${buildGuid}`;
if (yield cloud_runner_system_1.CloudRunnerSystem.Run(`kubectl`)) {
yield cloud_runner_system_1.CloudRunnerSystem.Run(`
git clone --single-branch --branch v1.8.6 https://github.com/rook/rook.git
cd rook/deploy/examples
kubectl create -f crds.yaml -f common.yaml -f operator.yaml
kubectl create -f cluster.yaml
`);
}
yield kubernetes_storage_1.default.createPersistentVolumeClaim(buildParameters, this.pvcName, this.kubeClient, this.namespace);
yield kubernetes_service_account_1.default.createServiceAccount(this.serviceAccountName, this.namespace, this.kubeClient);
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,7 @@ import KubernetesJobSpecFactory from './kubernetes-job-spec-factory';
import KubernetesServiceAccount from './kubernetes-service-account';
import CloudRunnerLogger from '../services/cloud-runner-logger';
import { CoreV1Api } from '@kubernetes/client-node';
import { CloudRunnerSystem } from '../../cli/remote-client/remote-client-services/cloud-runner-system';
class Kubernetes implements CloudRunnerProviderInterface {
private kubeConfig: k8s.KubeConfig;
@ -50,6 +51,14 @@ class Kubernetes implements CloudRunnerProviderInterface {
this.pvcName = `unity-builder-pvc-${buildGuid}`;
this.cleanupCronJobName = `unity-builder-cronjob-${buildGuid}`;
this.serviceAccountName = `service-account-${buildGuid}`;
if (await CloudRunnerSystem.Run(`kubectl`)) {
await CloudRunnerSystem.Run(`
git clone --single-branch --branch v1.8.6 https://github.com/rook/rook.git
cd rook/deploy/examples
kubectl create -f crds.yaml -f common.yaml -f operator.yaml
kubectl create -f cluster.yaml
`);
}
await KubernetesStorage.createPersistentVolumeClaim(
buildParameters,
this.pvcName,