disable aws pipe for now
parent
4128a154f6
commit
3488cec531
|
|
@ -3278,6 +3278,7 @@ class Kubernetes {
|
||||||
this.kubeConfig.loadFromDefault();
|
this.kubeConfig.loadFromDefault();
|
||||||
this.kubeClient = this.kubeConfig.makeApiClient(k8s.CoreV1Api);
|
this.kubeClient = this.kubeConfig.makeApiClient(k8s.CoreV1Api);
|
||||||
this.kubeClientBatch = this.kubeConfig.makeApiClient(k8s.BatchV1Api);
|
this.kubeClientBatch = this.kubeConfig.makeApiClient(k8s.BatchV1Api);
|
||||||
|
this.rbacAuthorizationV1Api = this.kubeConfig.makeApiClient(k8s.RbacAuthorizationV1Api);
|
||||||
this.namespace = 'default';
|
this.namespace = 'default';
|
||||||
cloud_runner_logger_1.default.log('Loaded default Kubernetes configuration for this environment');
|
cloud_runner_logger_1.default.log('Loaded default Kubernetes configuration for this environment');
|
||||||
}
|
}
|
||||||
|
|
@ -3410,7 +3411,7 @@ class Kubernetes {
|
||||||
try {
|
try {
|
||||||
const jobSpec = kubernetes_job_spec_factory_1.default.getJobSpec(commands, image, mountdir, workingdir, environment, secrets, this.buildGuid, this.buildParameters, this.secretName, this.pvcName, this.jobName, k8s, this.containerName);
|
const jobSpec = kubernetes_job_spec_factory_1.default.getJobSpec(commands, image, mountdir, workingdir, environment, secrets, this.buildGuid, this.buildParameters, this.secretName, this.pvcName, this.jobName, k8s, this.containerName);
|
||||||
await new Promise((promise) => setTimeout(promise, 15000));
|
await new Promise((promise) => setTimeout(promise, 15000));
|
||||||
await kubernetes_role_1.KubernetesRole.createRole(this.serviceAccountName, this.namespace);
|
await kubernetes_role_1.KubernetesRole.createRole(this.serviceAccountName, this.namespace, this.rbacAuthorizationV1Api);
|
||||||
const result = await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
const result = await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
||||||
cloud_runner_logger_1.default.log(`Build job created`);
|
cloud_runner_logger_1.default.log(`Build job created`);
|
||||||
await new Promise((promise) => setTimeout(promise, 5000));
|
await new Promise((promise) => setTimeout(promise, 5000));
|
||||||
|
|
@ -3432,7 +3433,7 @@ class Kubernetes {
|
||||||
try {
|
try {
|
||||||
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
||||||
await this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
|
await this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
|
||||||
await kubernetes_role_1.KubernetesRole.deleteRole(this.serviceAccountName, this.namespace);
|
await kubernetes_role_1.KubernetesRole.deleteRole(this.serviceAccountName, this.namespace, this.rbacAuthorizationV1Api);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
cloud_runner_logger_1.default.log(`Failed to cleanup`);
|
cloud_runner_logger_1.default.log(`Failed to cleanup`);
|
||||||
|
|
@ -3631,16 +3632,14 @@ exports["default"] = KubernetesPods;
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 88231:
|
/***/ 88231:
|
||||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.KubernetesRole = void 0;
|
exports.KubernetesRole = void 0;
|
||||||
const client_node_1 = __nccwpck_require__(89679);
|
|
||||||
class KubernetesRole {
|
class KubernetesRole {
|
||||||
static async createRole(serviceAccountName, namespace) {
|
static async createRole(serviceAccountName, namespace, rbac) {
|
||||||
const rbac = new client_node_1.RbacAuthorizationV1Api();
|
|
||||||
// create admin kubernetes role and role binding
|
// create admin kubernetes role and role binding
|
||||||
const roleBinding = {
|
const roleBinding = {
|
||||||
apiVersion: 'rbac.authorization.k8s.io/v1',
|
apiVersion: 'rbac.authorization.k8s.io/v1',
|
||||||
|
|
@ -3681,8 +3680,7 @@ class KubernetesRole {
|
||||||
const roleResponse = await rbac.createNamespacedRole(namespace, role);
|
const roleResponse = await rbac.createNamespacedRole(namespace, role);
|
||||||
return { roleBindingResponse, roleResponse };
|
return { roleBindingResponse, roleResponse };
|
||||||
}
|
}
|
||||||
static async deleteRole(serviceAccountName, namespace) {
|
static async deleteRole(serviceAccountName, namespace, rbac) {
|
||||||
const rbac = new client_node_1.RbacAuthorizationV1Api();
|
|
||||||
await rbac.deleteNamespacedRoleBinding(`${serviceAccountName}-admin`, namespace);
|
await rbac.deleteNamespacedRoleBinding(`${serviceAccountName}-admin`, namespace);
|
||||||
await rbac.deleteNamespacedRole(`${serviceAccountName}-admin`, namespace);
|
await rbac.deleteNamespacedRole(`${serviceAccountName}-admin`, namespace);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -22,6 +22,7 @@ class Kubernetes implements ProviderInterface {
|
||||||
public kubeConfig!: k8s.KubeConfig;
|
public kubeConfig!: k8s.KubeConfig;
|
||||||
public kubeClient!: k8s.CoreV1Api;
|
public kubeClient!: k8s.CoreV1Api;
|
||||||
public kubeClientBatch!: k8s.BatchV1Api;
|
public kubeClientBatch!: k8s.BatchV1Api;
|
||||||
|
public rbacAuthorizationV1Api!: k8s.RbacAuthorizationV1Api;
|
||||||
public buildGuid: string = '';
|
public buildGuid: string = '';
|
||||||
public buildParameters!: BuildParameters;
|
public buildParameters!: BuildParameters;
|
||||||
public pvcName: string = '';
|
public pvcName: string = '';
|
||||||
|
|
@ -40,6 +41,7 @@ class Kubernetes implements ProviderInterface {
|
||||||
this.kubeConfig.loadFromDefault();
|
this.kubeConfig.loadFromDefault();
|
||||||
this.kubeClient = this.kubeConfig.makeApiClient(k8s.CoreV1Api);
|
this.kubeClient = this.kubeConfig.makeApiClient(k8s.CoreV1Api);
|
||||||
this.kubeClientBatch = this.kubeConfig.makeApiClient(k8s.BatchV1Api);
|
this.kubeClientBatch = this.kubeConfig.makeApiClient(k8s.BatchV1Api);
|
||||||
|
this.rbacAuthorizationV1Api = this.kubeConfig.makeApiClient(k8s.RbacAuthorizationV1Api);
|
||||||
this.namespace = 'default';
|
this.namespace = 'default';
|
||||||
CloudRunnerLogger.log('Loaded default Kubernetes configuration for this environment');
|
CloudRunnerLogger.log('Loaded default Kubernetes configuration for this environment');
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +247,7 @@ class Kubernetes implements ProviderInterface {
|
||||||
this.containerName,
|
this.containerName,
|
||||||
);
|
);
|
||||||
await new Promise((promise) => setTimeout(promise, 15000));
|
await new Promise((promise) => setTimeout(promise, 15000));
|
||||||
await KubernetesRole.createRole(this.serviceAccountName, this.namespace);
|
await KubernetesRole.createRole(this.serviceAccountName, this.namespace, this.rbacAuthorizationV1Api);
|
||||||
const result = await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
const result = await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
||||||
CloudRunnerLogger.log(`Build job created`);
|
CloudRunnerLogger.log(`Build job created`);
|
||||||
await new Promise((promise) => setTimeout(promise, 5000));
|
await new Promise((promise) => setTimeout(promise, 5000));
|
||||||
|
|
@ -269,7 +271,7 @@ class Kubernetes implements ProviderInterface {
|
||||||
try {
|
try {
|
||||||
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
||||||
await this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
|
await this.kubeClient.deleteNamespacedPod(this.podName, this.namespace);
|
||||||
await KubernetesRole.deleteRole(this.serviceAccountName, this.namespace);
|
await KubernetesRole.deleteRole(this.serviceAccountName, this.namespace, this.rbacAuthorizationV1Api);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
CloudRunnerLogger.log(`Failed to cleanup`);
|
CloudRunnerLogger.log(`Failed to cleanup`);
|
||||||
if (error.response.body.reason !== `NotFound`) {
|
if (error.response.body.reason !== `NotFound`) {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import { RbacAuthorizationV1Api } from '@kubernetes/client-node';
|
import { RbacAuthorizationV1Api } from '@kubernetes/client-node';
|
||||||
|
|
||||||
class KubernetesRole {
|
class KubernetesRole {
|
||||||
static async createRole(serviceAccountName: string, namespace: string) {
|
static async createRole(serviceAccountName: string, namespace: string, rbac: RbacAuthorizationV1Api) {
|
||||||
const rbac = new RbacAuthorizationV1Api();
|
|
||||||
|
|
||||||
// create admin kubernetes role and role binding
|
// create admin kubernetes role and role binding
|
||||||
const roleBinding = {
|
const roleBinding = {
|
||||||
apiVersion: 'rbac.authorization.k8s.io/v1',
|
apiVersion: 'rbac.authorization.k8s.io/v1',
|
||||||
|
|
@ -47,8 +45,7 @@ class KubernetesRole {
|
||||||
return { roleBindingResponse, roleResponse };
|
return { roleBindingResponse, roleResponse };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async deleteRole(serviceAccountName: string, namespace: string) {
|
public static async deleteRole(serviceAccountName: string, namespace: string, rbac: RbacAuthorizationV1Api) {
|
||||||
const rbac = new RbacAuthorizationV1Api();
|
|
||||||
await rbac.deleteNamespacedRoleBinding(`${serviceAccountName}-admin`, namespace);
|
await rbac.deleteNamespacedRoleBinding(`${serviceAccountName}-admin`, namespace);
|
||||||
await rbac.deleteNamespacedRole(`${serviceAccountName}-admin`, namespace);
|
await rbac.deleteNamespacedRole(`${serviceAccountName}-admin`, namespace);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue