revert(build): remove app build pipeline revamp (Nixpacks/MinIO/Trivy/registry GC)
Reverts commits3eff38fandc379a23and restores the previous Kaniko-only build pipeline (runtime detection + per-runtime Dockerfile generation, disk-based source upload). Removed: Nixpacks Dockerfile generation, MinIO source storage (common/storage), Bull build queue + Redis build state (common/redis, deployment.processor), Trivy image scan (scan.service, deployment.vulnerabilitySummary), and daily registry garbage collection (registry-gc). Nothing outside the build/deploy path depended on these. Backend tsc + 105/106 tests green (the pre-existing helm.service chartPath failure is unrelated); frontend tsc green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1102,133 +1102,9 @@ export class ClustersService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
await this.ensureK3sRegistryMirrors(appsApi, registryUrl);
|
||||
|
||||
// ── 8. MinIO (S3-compatible) for application source archives ──
|
||||
await this.ensureMinioInfrastructure(coreApi, appsApi, buildNs);
|
||||
|
||||
this.logger.log(`✅ Cluster bootstrap complete — registry: ${registryUrl}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provision in-cluster MinIO (Deployment + PVC + Service + credentials Secret)
|
||||
* in the build namespace. Application source archives are uploaded here by the
|
||||
* API and pulled by build pods via presigned URLs.
|
||||
*/
|
||||
private async ensureMinioInfrastructure(coreApi: k8s.CoreV1Api, appsApi: k8s.AppsV1Api, buildNs: string): Promise<void> {
|
||||
const accessKey = this.configService.get<string>('minio.accessKey') || 'cloudhost';
|
||||
const secretKey = this.configService.get<string>('minio.secretKey') || '';
|
||||
const pvcName = 'minio-data';
|
||||
const deployName = 'minio';
|
||||
const svcName = 'minio';
|
||||
const secretName = 'minio-credentials';
|
||||
|
||||
// 1. Credentials Secret (shared by the MinIO server env and the API client)
|
||||
const minioSecret: k8s.V1Secret = {
|
||||
metadata: { name: secretName, namespace: buildNs },
|
||||
type: 'Opaque',
|
||||
data: {
|
||||
accesskey: Buffer.from(accessKey).toString('base64'),
|
||||
secretkey: Buffer.from(secretKey).toString('base64'),
|
||||
},
|
||||
};
|
||||
try {
|
||||
await coreApi.readNamespacedSecret({ name: secretName, namespace: buildNs });
|
||||
await coreApi.replaceNamespacedSecret({ name: secretName, namespace: buildNs, body: minioSecret });
|
||||
} catch (err: any) {
|
||||
if (err.code === 404 || err.body?.code === 404) {
|
||||
await coreApi.createNamespacedSecret({ namespace: buildNs, body: minioSecret });
|
||||
this.logger.log(`Created ${secretName} Secret`);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Data PVC
|
||||
try {
|
||||
await coreApi.readNamespacedPersistentVolumeClaim({ name: pvcName, namespace: buildNs });
|
||||
} catch (err: any) {
|
||||
if (err.code === 404 || err.body?.code === 404) {
|
||||
await coreApi.createNamespacedPersistentVolumeClaim({
|
||||
namespace: buildNs,
|
||||
body: {
|
||||
metadata: { name: pvcName, namespace: buildNs },
|
||||
spec: { accessModes: ['ReadWriteOnce'], resources: { requests: { storage: '20Gi' } } },
|
||||
},
|
||||
});
|
||||
this.logger.log(`Created PVC "${pvcName}" (20Gi)`);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Deployment
|
||||
try {
|
||||
await appsApi.readNamespacedDeployment({ name: deployName, namespace: buildNs });
|
||||
} catch (err: any) {
|
||||
if (err.code === 404 || err.body?.code === 404) {
|
||||
await appsApi.createNamespacedDeployment({
|
||||
namespace: buildNs,
|
||||
body: {
|
||||
metadata: { name: deployName, namespace: buildNs, labels: { app: 'minio' } },
|
||||
spec: {
|
||||
replicas: 1,
|
||||
selector: { matchLabels: { app: 'minio' } },
|
||||
template: {
|
||||
metadata: { labels: { app: 'minio' } },
|
||||
spec: {
|
||||
containers: [
|
||||
{
|
||||
name: 'minio',
|
||||
image: process.env.MINIO_IMAGE || 'minio/minio:latest',
|
||||
args: ['server', '/data', '--console-address', ':9001'],
|
||||
env: [
|
||||
{ name: 'MINIO_ROOT_USER', valueFrom: { secretKeyRef: { name: secretName, key: 'accesskey' } } },
|
||||
{ name: 'MINIO_ROOT_PASSWORD', valueFrom: { secretKeyRef: { name: secretName, key: 'secretkey' } } },
|
||||
],
|
||||
ports: [{ containerPort: 9000 }, { containerPort: 9001 }],
|
||||
volumeMounts: [{ name: 'data', mountPath: '/data' }],
|
||||
resources: {
|
||||
requests: { cpu: '100m', memory: '256Mi' },
|
||||
limits: { cpu: '1', memory: '1Gi' },
|
||||
},
|
||||
},
|
||||
],
|
||||
volumes: [{ name: 'data', persistentVolumeClaim: { claimName: pvcName } }],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
this.logger.log(`Created MinIO Deployment`);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. ClusterIP Service (API :9000, console :9001)
|
||||
try {
|
||||
await coreApi.readNamespacedService({ name: svcName, namespace: buildNs });
|
||||
} catch (err: any) {
|
||||
if (err.code === 404 || err.body?.code === 404) {
|
||||
await coreApi.createNamespacedService({
|
||||
namespace: buildNs,
|
||||
body: {
|
||||
metadata: { name: svcName, namespace: buildNs, labels: { app: 'minio' } },
|
||||
spec: {
|
||||
selector: { app: 'minio' },
|
||||
ports: [
|
||||
{ name: 'api', port: 9000, targetPort: 9000 as any, protocol: 'TCP' },
|
||||
{ name: 'console', port: 9001, targetPort: 9001 as any, protocol: 'TCP' },
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
this.logger.log(`Created MinIO Service`);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** In-cluster registry mirror for k3s/containerd (HTTP). Removes legacy external-registry DaemonSet if present. */
|
||||
private async ensureK3sRegistryMirrors(appsApi: k8s.AppsV1Api, registryUrl: string): Promise<void> {
|
||||
const namespace = 'kube-system';
|
||||
|
||||
Reference in New Issue
Block a user