mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-15 20:46:50 -07:00
9d475434d3
* Rename "Cloud Runner" to "Orchestrator" across entire codebase Breaking change: All CloudRunner classes, options, environment variables, and action.yml inputs have been renamed to Orchestrator equivalents. - Renamed src/model/cloud-runner/ directory to src/model/orchestrator/ - Renamed all cloud-runner-* files to orchestrator-* - Renamed all CloudRunner* classes to Orchestrator* (15+ classes) - Renamed all cloudRunner* properties to orchestrator* equivalents - Renamed CLOUD_RUNNER_* env vars to ORCHESTRATOR_* - Updated action.yml [CloudRunner] markers to [Orchestrator] - Updated workflow files and package.json test scripts - Updated all runtime strings (cache paths, log messages, branch refs) - Rebuilt dist/index.js No backward compatibility layer is provided. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove tracked log/temp files and add to .gitignore Remove $LOG_FILE and temp/job-log.txt debug artifacts that should not be in the repository. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { RbacAuthorizationV1Api } from '@kubernetes/client-node';
|
|
|
|
class KubernetesRole {
|
|
static async createRole(serviceAccountName: string, namespace: string, rbac: RbacAuthorizationV1Api) {
|
|
// create admin kubernetes role and role binding
|
|
const roleBinding = {
|
|
apiVersion: 'rbac.authorization.k8s.io/v1',
|
|
kind: 'RoleBinding',
|
|
metadata: {
|
|
name: `${serviceAccountName}-admin`,
|
|
namespace,
|
|
},
|
|
subjects: [
|
|
{
|
|
kind: 'ServiceAccount',
|
|
name: serviceAccountName,
|
|
namespace,
|
|
},
|
|
],
|
|
roleRef: {
|
|
apiGroup: 'rbac.authorization.k8s.io',
|
|
kind: 'Role',
|
|
name: `${serviceAccountName}-admin`,
|
|
},
|
|
};
|
|
|
|
const role = {
|
|
apiVersion: 'rbac.authorization.k8s.io/v1',
|
|
kind: 'Role',
|
|
metadata: {
|
|
name: `${serviceAccountName}-admin`,
|
|
namespace,
|
|
},
|
|
rules: [
|
|
{
|
|
apiGroups: ['*'],
|
|
resources: ['*'],
|
|
verbs: ['*'],
|
|
},
|
|
],
|
|
};
|
|
const roleBindingResponse = await rbac.createNamespacedRoleBinding(namespace, roleBinding);
|
|
const roleResponse = await rbac.createNamespacedRole(namespace, role);
|
|
|
|
return { roleBindingResponse, roleResponse };
|
|
}
|
|
|
|
public static async deleteRole(serviceAccountName: string, namespace: string, rbac: RbacAuthorizationV1Api) {
|
|
await rbac.deleteNamespacedRoleBinding(`${serviceAccountName}-admin`, namespace);
|
|
await rbac.deleteNamespacedRole(`${serviceAccountName}-admin`, namespace);
|
|
}
|
|
}
|
|
export { KubernetesRole };
|