@flui-cloud/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +124 -0
- package/bin/run +17 -0
- package/lib/cli/src/background/cluster-worker.d.ts +11 -0
- package/lib/cli/src/background/cluster-worker.js +90 -0
- package/lib/cli/src/cli-providers.module.d.ts +2 -0
- package/lib/cli/src/cli-providers.module.js +118 -0
- package/lib/cli/src/cli.module.d.ts +13 -0
- package/lib/cli/src/cli.module.js +80 -0
- package/lib/cli/src/commands/_diag-oidc.d.ts +6 -0
- package/lib/cli/src/commands/_diag-oidc.js +132 -0
- package/lib/cli/src/commands/app/backup/create.d.ts +20 -0
- package/lib/cli/src/commands/app/backup/create.js +128 -0
- package/lib/cli/src/commands/app/backup/delete.d.ts +19 -0
- package/lib/cli/src/commands/app/backup/delete.js +95 -0
- package/lib/cli/src/commands/app/build.d.ts +17 -0
- package/lib/cli/src/commands/app/build.js +133 -0
- package/lib/cli/src/commands/app/builds.d.ts +14 -0
- package/lib/cli/src/commands/app/builds.js +82 -0
- package/lib/cli/src/commands/app/crash.d.ts +16 -0
- package/lib/cli/src/commands/app/crash.js +106 -0
- package/lib/cli/src/commands/app/crashes.d.ts +15 -0
- package/lib/cli/src/commands/app/crashes.js +99 -0
- package/lib/cli/src/commands/app/delete.d.ts +16 -0
- package/lib/cli/src/commands/app/delete.js +149 -0
- package/lib/cli/src/commands/app/image/delete.d.ts +18 -0
- package/lib/cli/src/commands/app/image/delete.js +72 -0
- package/lib/cli/src/commands/app/init.d.ts +40 -0
- package/lib/cli/src/commands/app/init.js +436 -0
- package/lib/cli/src/commands/app/list.d.ts +11 -0
- package/lib/cli/src/commands/app/list.js +84 -0
- package/lib/cli/src/commands/app/logs.d.ts +18 -0
- package/lib/cli/src/commands/app/logs.js +121 -0
- package/lib/cli/src/commands/app/metrics.d.ts +17 -0
- package/lib/cli/src/commands/app/metrics.js +100 -0
- package/lib/cli/src/commands/app/redeploy.d.ts +14 -0
- package/lib/cli/src/commands/app/redeploy.js +60 -0
- package/lib/cli/src/commands/app/releases.d.ts +15 -0
- package/lib/cli/src/commands/app/releases.js +117 -0
- package/lib/cli/src/commands/app/restart.d.ts +12 -0
- package/lib/cli/src/commands/app/restart.js +44 -0
- package/lib/cli/src/commands/app/scale.d.ts +13 -0
- package/lib/cli/src/commands/app/scale.js +58 -0
- package/lib/cli/src/commands/app/snapshot/create.d.ts +14 -0
- package/lib/cli/src/commands/app/snapshot/create.js +85 -0
- package/lib/cli/src/commands/app/snapshot/delete.d.ts +14 -0
- package/lib/cli/src/commands/app/snapshot/delete.js +63 -0
- package/lib/cli/src/commands/app/snapshot/list.d.ts +11 -0
- package/lib/cli/src/commands/app/snapshot/list.js +82 -0
- package/lib/cli/src/commands/app/snapshot/restore.d.ts +15 -0
- package/lib/cli/src/commands/app/snapshot/restore.js +74 -0
- package/lib/cli/src/commands/app/snapshot/swap.d.ts +15 -0
- package/lib/cli/src/commands/app/snapshot/swap.js +68 -0
- package/lib/cli/src/commands/app/start.d.ts +12 -0
- package/lib/cli/src/commands/app/start.js +45 -0
- package/lib/cli/src/commands/app/status.d.ts +15 -0
- package/lib/cli/src/commands/app/status.js +108 -0
- package/lib/cli/src/commands/app/stop.d.ts +12 -0
- package/lib/cli/src/commands/app/stop.js +45 -0
- package/lib/cli/src/commands/app/versions.d.ts +14 -0
- package/lib/cli/src/commands/app/versions.js +80 -0
- package/lib/cli/src/commands/auth/generate-api-key.d.ts +12 -0
- package/lib/cli/src/commands/auth/generate-api-key.js +90 -0
- package/lib/cli/src/commands/auth/login.d.ts +11 -0
- package/lib/cli/src/commands/auth/login.js +296 -0
- package/lib/cli/src/commands/auth/reset-password.d.ts +15 -0
- package/lib/cli/src/commands/auth/reset-password.js +253 -0
- package/lib/cli/src/commands/backup/destination/create.d.ts +22 -0
- package/lib/cli/src/commands/backup/destination/create.js +102 -0
- package/lib/cli/src/commands/backup/destination/delete.d.ts +11 -0
- package/lib/cli/src/commands/backup/destination/delete.js +46 -0
- package/lib/cli/src/commands/backup/destination/list.d.ts +9 -0
- package/lib/cli/src/commands/backup/destination/list.js +42 -0
- package/lib/cli/src/commands/backup/destination/show.d.ts +11 -0
- package/lib/cli/src/commands/backup/destination/show.js +45 -0
- package/lib/cli/src/commands/backup/destination/test.d.ts +8 -0
- package/lib/cli/src/commands/backup/destination/test.js +39 -0
- package/lib/cli/src/commands/backup/job/list.d.ts +9 -0
- package/lib/cli/src/commands/backup/job/list.js +38 -0
- package/lib/cli/src/commands/backup/job/run.d.ts +8 -0
- package/lib/cli/src/commands/backup/job/run.js +32 -0
- package/lib/cli/src/commands/backup/job/show.d.ts +11 -0
- package/lib/cli/src/commands/backup/job/show.js +38 -0
- package/lib/cli/src/commands/backup/policy/create.d.ts +21 -0
- package/lib/cli/src/commands/backup/policy/create.js +97 -0
- package/lib/cli/src/commands/backup/policy/delete.d.ts +11 -0
- package/lib/cli/src/commands/backup/policy/delete.js +42 -0
- package/lib/cli/src/commands/backup/policy/list.d.ts +9 -0
- package/lib/cli/src/commands/backup/policy/list.js +40 -0
- package/lib/cli/src/commands/backup/policy/show.d.ts +11 -0
- package/lib/cli/src/commands/backup/policy/show.js +45 -0
- package/lib/cli/src/commands/backup/restore/create.d.ts +14 -0
- package/lib/cli/src/commands/backup/restore/create.js +68 -0
- package/lib/cli/src/commands/backup/restore/list.d.ts +8 -0
- package/lib/cli/src/commands/backup/restore/list.js +33 -0
- package/lib/cli/src/commands/backup/restore/preview.d.ts +9 -0
- package/lib/cli/src/commands/backup/restore/preview.js +29 -0
- package/lib/cli/src/commands/backup/restore/show.d.ts +11 -0
- package/lib/cli/src/commands/backup/restore/show.js +40 -0
- package/lib/cli/src/commands/catalog/validate.d.ts +14 -0
- package/lib/cli/src/commands/catalog/validate.js +155 -0
- package/lib/cli/src/commands/cluster/destroy.d.ts +15 -0
- package/lib/cli/src/commands/cluster/destroy.js +137 -0
- package/lib/cli/src/commands/config/get.d.ts +9 -0
- package/lib/cli/src/commands/config/get.js +47 -0
- package/lib/cli/src/commands/config/list.d.ts +15 -0
- package/lib/cli/src/commands/config/list.js +109 -0
- package/lib/cli/src/commands/config/remove.d.ts +12 -0
- package/lib/cli/src/commands/config/remove.js +92 -0
- package/lib/cli/src/commands/config/set.d.ts +15 -0
- package/lib/cli/src/commands/config/set.js +152 -0
- package/lib/cli/src/commands/config/show.d.ts +6 -0
- package/lib/cli/src/commands/config/show.js +15 -0
- package/lib/cli/src/commands/context/create.d.ts +12 -0
- package/lib/cli/src/commands/context/create.js +46 -0
- package/lib/cli/src/commands/context/delete.d.ts +12 -0
- package/lib/cli/src/commands/context/delete.js +53 -0
- package/lib/cli/src/commands/context/list.d.ts +6 -0
- package/lib/cli/src/commands/context/list.js +29 -0
- package/lib/cli/src/commands/context/show.d.ts +6 -0
- package/lib/cli/src/commands/context/show.js +12 -0
- package/lib/cli/src/commands/context/use.d.ts +9 -0
- package/lib/cli/src/commands/context/use.js +30 -0
- package/lib/cli/src/commands/deploy.d.ts +49 -0
- package/lib/cli/src/commands/deploy.js +542 -0
- package/lib/cli/src/commands/dev/creds.d.ts +19 -0
- package/lib/cli/src/commands/dev/creds.js +290 -0
- package/lib/cli/src/commands/dev/tunnel.d.ts +15 -0
- package/lib/cli/src/commands/dev/tunnel.js +268 -0
- package/lib/cli/src/commands/dns/cleanup.d.ts +11 -0
- package/lib/cli/src/commands/dns/cleanup.js +93 -0
- package/lib/cli/src/commands/env/capacity.d.ts +12 -0
- package/lib/cli/src/commands/env/capacity.js +177 -0
- package/lib/cli/src/commands/env/create.d.ts +21 -0
- package/lib/cli/src/commands/env/create.js +721 -0
- package/lib/cli/src/commands/env/credentials.d.ts +21 -0
- package/lib/cli/src/commands/env/credentials.js +435 -0
- package/lib/cli/src/commands/env/destroy.d.ts +9 -0
- package/lib/cli/src/commands/env/destroy.js +145 -0
- package/lib/cli/src/commands/env/diag-ca.d.ts +14 -0
- package/lib/cli/src/commands/env/diag-ca.js +192 -0
- package/lib/cli/src/commands/env/export-config.d.ts +39 -0
- package/lib/cli/src/commands/env/export-config.js +386 -0
- package/lib/cli/src/commands/env/force-ready.d.ts +10 -0
- package/lib/cli/src/commands/env/force-ready.js +222 -0
- package/lib/cli/src/commands/env/inspect.d.ts +12 -0
- package/lib/cli/src/commands/env/inspect.js +192 -0
- package/lib/cli/src/commands/env/kubectl.d.ts +9 -0
- package/lib/cli/src/commands/env/kubectl.js +33 -0
- package/lib/cli/src/commands/env/logs.d.ts +12 -0
- package/lib/cli/src/commands/env/logs.js +136 -0
- package/lib/cli/src/commands/env/orphan-volumes.d.ts +11 -0
- package/lib/cli/src/commands/env/orphan-volumes.js +153 -0
- package/lib/cli/src/commands/env/refresh-kubeconfig.d.ts +6 -0
- package/lib/cli/src/commands/env/refresh-kubeconfig.js +66 -0
- package/lib/cli/src/commands/env/repair-ssh-ca.d.ts +11 -0
- package/lib/cli/src/commands/env/repair-ssh-ca.js +137 -0
- package/lib/cli/src/commands/env/restart.d.ts +10 -0
- package/lib/cli/src/commands/env/restart.js +187 -0
- package/lib/cli/src/commands/env/scale-master.d.ts +11 -0
- package/lib/cli/src/commands/env/scale-master.js +160 -0
- package/lib/cli/src/commands/env/scale-node.d.ts +14 -0
- package/lib/cli/src/commands/env/scale-node.js +139 -0
- package/lib/cli/src/commands/env/status.d.ts +10 -0
- package/lib/cli/src/commands/env/status.js +182 -0
- package/lib/cli/src/commands/env/stop.d.ts +6 -0
- package/lib/cli/src/commands/env/stop.js +147 -0
- package/lib/cli/src/commands/env/storage-expand.d.ts +10 -0
- package/lib/cli/src/commands/env/storage-expand.js +124 -0
- package/lib/cli/src/commands/env/storage.d.ts +8 -0
- package/lib/cli/src/commands/env/storage.js +92 -0
- package/lib/cli/src/commands/env/sync.d.ts +17 -0
- package/lib/cli/src/commands/env/sync.js +225 -0
- package/lib/cli/src/commands/env/uncordon.d.ts +9 -0
- package/lib/cli/src/commands/env/uncordon.js +73 -0
- package/lib/cli/src/commands/env/update-firewall.d.ts +9 -0
- package/lib/cli/src/commands/env/update-firewall.js +185 -0
- package/lib/cli/src/commands/integration/connect.d.ts +13 -0
- package/lib/cli/src/commands/integration/connect.js +161 -0
- package/lib/cli/src/commands/integration/ghcr-pat/revoke.d.ts +9 -0
- package/lib/cli/src/commands/integration/ghcr-pat/revoke.js +61 -0
- package/lib/cli/src/commands/integration/ghcr-pat/set.d.ts +12 -0
- package/lib/cli/src/commands/integration/ghcr-pat/set.js +141 -0
- package/lib/cli/src/commands/integration/ghcr-pat/status.d.ts +6 -0
- package/lib/cli/src/commands/integration/ghcr-pat/status.js +69 -0
- package/lib/cli/src/commands/integration/installations.d.ts +6 -0
- package/lib/cli/src/commands/integration/installations.js +45 -0
- package/lib/cli/src/commands/integration/list.d.ts +8 -0
- package/lib/cli/src/commands/integration/list.js +67 -0
- package/lib/cli/src/commands/integration/remove-installation.d.ts +12 -0
- package/lib/cli/src/commands/integration/remove-installation.js +71 -0
- package/lib/cli/src/commands/integration/setup-github-app.d.ts +10 -0
- package/lib/cli/src/commands/integration/setup-github-app.js +162 -0
- package/lib/cli/src/commands/node/add.d.ts +11 -0
- package/lib/cli/src/commands/node/add.js +103 -0
- package/lib/cli/src/commands/node/list.d.ts +11 -0
- package/lib/cli/src/commands/node/list.js +83 -0
- package/lib/cli/src/commands/node/remove.d.ts +16 -0
- package/lib/cli/src/commands/node/remove.js +161 -0
- package/lib/cli/src/commands/reconcile.d.ts +19 -0
- package/lib/cli/src/commands/reconcile.js +171 -0
- package/lib/cli/src/commands/repo/connect.d.ts +12 -0
- package/lib/cli/src/commands/repo/connect.js +133 -0
- package/lib/cli/src/commands/repo/disconnect.d.ts +12 -0
- package/lib/cli/src/commands/repo/disconnect.js +73 -0
- package/lib/cli/src/commands/repo/list.d.ts +9 -0
- package/lib/cli/src/commands/repo/list.js +66 -0
- package/lib/cli/src/commands/server-types/list.d.ts +12 -0
- package/lib/cli/src/commands/server-types/list.js +205 -0
- package/lib/cli/src/commands/ssh.d.ts +9 -0
- package/lib/cli/src/commands/ssh.js +94 -0
- package/lib/cli/src/commands/standalone/install.d.ts +27 -0
- package/lib/cli/src/commands/standalone/install.js +330 -0
- package/lib/cli/src/commands/template/use.d.ts +16 -0
- package/lib/cli/src/commands/template/use.js +111 -0
- package/lib/cli/src/commands/update.d.ts +6 -0
- package/lib/cli/src/commands/update.js +87 -0
- package/lib/cli/src/config/bootstrap.config.d.ts +37 -0
- package/lib/cli/src/config/bootstrap.config.js +33 -0
- package/lib/cli/src/config/defaults.d.ts +46 -0
- package/lib/cli/src/config/defaults.js +79 -0
- package/lib/cli/src/config/key-router.d.ts +22 -0
- package/lib/cli/src/config/key-router.js +45 -0
- package/lib/cli/src/config/preferences-echo.d.ts +9 -0
- package/lib/cli/src/config/preferences-echo.js +61 -0
- package/lib/cli/src/config/preferences-resolver.d.ts +43 -0
- package/lib/cli/src/config/preferences-resolver.js +100 -0
- package/lib/cli/src/config/preferences-schema.d.ts +32 -0
- package/lib/cli/src/config/preferences-schema.js +53 -0
- package/lib/cli/src/hooks/command_not_found.d.ts +3 -0
- package/lib/cli/src/hooks/command_not_found.js +44 -0
- package/lib/cli/src/lib/api-client.d.ts +58 -0
- package/lib/cli/src/lib/api-client.js +162 -0
- package/lib/cli/src/lib/backup-client.d.ts +131 -0
- package/lib/cli/src/lib/backup-client.js +78 -0
- package/lib/cli/src/lib/browser-callback.d.ts +3 -0
- package/lib/cli/src/lib/browser-callback.js +83 -0
- package/lib/cli/src/lib/byos-precheck.d.ts +29 -0
- package/lib/cli/src/lib/byos-precheck.js +162 -0
- package/lib/cli/src/lib/ca-utils.d.ts +13 -0
- package/lib/cli/src/lib/ca-utils.js +72 -0
- package/lib/cli/src/lib/cli-credential-provider.service.d.ts +31 -0
- package/lib/cli/src/lib/cli-credential-provider.service.js +86 -0
- package/lib/cli/src/lib/config-storage.d.ts +128 -0
- package/lib/cli/src/lib/config-storage.js +349 -0
- package/lib/cli/src/lib/config.d.ts +23 -0
- package/lib/cli/src/lib/config.js +113 -0
- package/lib/cli/src/lib/context-banner.d.ts +12 -0
- package/lib/cli/src/lib/context-banner.js +25 -0
- package/lib/cli/src/lib/format-bytes.d.ts +1 -0
- package/lib/cli/src/lib/format-bytes.js +18 -0
- package/lib/cli/src/lib/framework-detector.d.ts +12 -0
- package/lib/cli/src/lib/framework-detector.js +216 -0
- package/lib/cli/src/lib/framework-postchecks.d.ts +11 -0
- package/lib/cli/src/lib/framework-postchecks.js +152 -0
- package/lib/cli/src/lib/nest-app.d.ts +17 -0
- package/lib/cli/src/lib/nest-app.js +69 -0
- package/lib/cli/src/lib/nip-base-domain.util.d.ts +8 -0
- package/lib/cli/src/lib/nip-base-domain.util.js +17 -0
- package/lib/cli/src/lib/profile-manager.d.ts +56 -0
- package/lib/cli/src/lib/profile-manager.js +207 -0
- package/lib/cli/src/lib/prompts.d.ts +67 -0
- package/lib/cli/src/lib/prompts.js +475 -0
- package/lib/cli/src/lib/provider-credential-schemas.d.ts +29 -0
- package/lib/cli/src/lib/provider-credential-schemas.js +48 -0
- package/lib/cli/src/lib/repositories/cli-cluster.repository.d.ts +56 -0
- package/lib/cli/src/lib/repositories/cli-cluster.repository.js +216 -0
- package/lib/cli/src/lib/repositories/cli-firewall.repository.d.ts +13 -0
- package/lib/cli/src/lib/repositories/cli-firewall.repository.js +147 -0
- package/lib/cli/src/lib/repositories/cli-node.repository.d.ts +26 -0
- package/lib/cli/src/lib/repositories/cli-node.repository.js +164 -0
- package/lib/cli/src/lib/repositories/cli-operation.repository.d.ts +57 -0
- package/lib/cli/src/lib/repositories/cli-operation.repository.js +226 -0
- package/lib/cli/src/lib/repositories/cli-vnet.repository.d.ts +22 -0
- package/lib/cli/src/lib/repositories/cli-vnet.repository.js +175 -0
- package/lib/cli/src/lib/repositories/index.d.ts +5 -0
- package/lib/cli/src/lib/repositories/index.js +21 -0
- package/lib/cli/src/lib/resolve-cluster.d.ts +16 -0
- package/lib/cli/src/lib/resolve-cluster.js +34 -0
- package/lib/cli/src/lib/scaleway-validator.d.ts +5 -0
- package/lib/cli/src/lib/scaleway-validator.js +87 -0
- package/lib/cli/src/lib/server-utils.d.ts +8 -0
- package/lib/cli/src/lib/server-utils.js +19 -0
- package/lib/cli/src/lib/services/cli-app.service.d.ts +294 -0
- package/lib/cli/src/lib/services/cli-app.service.js +162 -0
- package/lib/cli/src/lib/services/cli-node.service.d.ts +43 -0
- package/lib/cli/src/lib/services/cli-node.service.js +34 -0
- package/lib/cli/src/lib/services/provider-sync.service.d.ts +90 -0
- package/lib/cli/src/lib/services/provider-sync.service.js +178 -0
- package/lib/cli/src/lib/services/reconciliation.service.d.ts +40 -0
- package/lib/cli/src/lib/services/reconciliation.service.js +119 -0
- package/lib/cli/src/lib/services/vnet-provisioning.service.d.ts +37 -0
- package/lib/cli/src/lib/services/vnet-provisioning.service.js +164 -0
- package/lib/cli/src/lib/ssh-key.d.ts +23 -0
- package/lib/cli/src/lib/ssh-key.js +126 -0
- package/lib/cli/src/lib/template-fetcher.d.ts +25 -0
- package/lib/cli/src/lib/template-fetcher.js +48 -0
- package/lib/cli/src/lib/templates/firewall-rules.d.ts +8 -0
- package/lib/cli/src/lib/templates/firewall-rules.js +17 -0
- package/lib/cli/src/lib/typeorm-shim.d.ts +12 -0
- package/lib/cli/src/lib/typeorm-shim.js +17 -0
- package/lib/cli/src/lib/utils/env-file.d.ts +2 -0
- package/lib/cli/src/lib/utils/env-file.js +40 -0
- package/lib/cli/src/lib/utils/ip-detection.d.ts +27 -0
- package/lib/cli/src/lib/utils/ip-detection.js +144 -0
- package/lib/cli/src/modules/cli-infrastructure.module.d.ts +14 -0
- package/lib/cli/src/modules/cli-infrastructure.module.js +249 -0
- package/lib/cli/src/services/cli-ca.service.d.ts +62 -0
- package/lib/cli/src/services/cli-ca.service.js +281 -0
- package/lib/cli/src/services/cli-cluster-creator.service.d.ts +78 -0
- package/lib/cli/src/services/cli-cluster-creator.service.js +655 -0
- package/lib/cli/src/services/cli-clusters.service.d.ts +74 -0
- package/lib/cli/src/services/cli-clusters.service.js +762 -0
- package/lib/cli/src/services/cli-endpoint-resolver.service.d.ts +33 -0
- package/lib/cli/src/services/cli-endpoint-resolver.service.js +195 -0
- package/lib/cli/src/services/cli-k3s-script.service.d.ts +114 -0
- package/lib/cli/src/services/cli-k3s-script.service.js +288 -0
- package/lib/cli/src/services/cli-logger.service.d.ts +56 -0
- package/lib/cli/src/services/cli-logger.service.js +188 -0
- package/lib/cli/src/services/cli-observability-cluster.service.d.ts +128 -0
- package/lib/cli/src/services/cli-observability-cluster.service.js +525 -0
- package/lib/cli/src/services/cli-ssh.service.d.ts +90 -0
- package/lib/cli/src/services/cli-ssh.service.js +457 -0
- package/lib/cli/src/services/server-type-cache.service.d.ts +34 -0
- package/lib/cli/src/services/server-type-cache.service.js +156 -0
- package/lib/cli/src/services/server-type-validator.service.d.ts +80 -0
- package/lib/cli/src/services/server-type-validator.service.js +366 -0
- package/lib/cli/src/types/index.d.ts +41 -0
- package/lib/cli/src/types/index.js +2 -0
- package/lib/src/common/utils/project-root.util.d.ts +22 -0
- package/lib/src/common/utils/project-root.util.js +78 -0
- package/lib/src/modules/access/access.controller.d.ts +30 -0
- package/lib/src/modules/access/access.controller.js +336 -0
- package/lib/src/modules/access/access.module.d.ts +2 -0
- package/lib/src/modules/access/access.module.js +92 -0
- package/lib/src/modules/access/controllers/ca.controller.d.ts +22 -0
- package/lib/src/modules/access/controllers/ca.controller.js +242 -0
- package/lib/src/modules/access/dto/api-token.dto.d.ts +11 -0
- package/lib/src/modules/access/dto/api-token.dto.js +74 -0
- package/lib/src/modules/access/dto/bearer-token.dto.d.ts +7 -0
- package/lib/src/modules/access/dto/bearer-token.dto.js +36 -0
- package/lib/src/modules/access/dto/ca-public-key.dto.d.ts +7 -0
- package/lib/src/modules/access/dto/ca-public-key.dto.js +52 -0
- package/lib/src/modules/access/dto/create-api-token.dto.d.ts +7 -0
- package/lib/src/modules/access/dto/create-api-token.dto.js +64 -0
- package/lib/src/modules/access/dto/create-bearer-token.dto.d.ts +9 -0
- package/lib/src/modules/access/dto/create-bearer-token.dto.js +58 -0
- package/lib/src/modules/access/dto/create-ssh-key.dto.d.ts +7 -0
- package/lib/src/modules/access/dto/create-ssh-key.dto.js +61 -0
- package/lib/src/modules/access/dto/refresh-token.dto.d.ts +7 -0
- package/lib/src/modules/access/dto/refresh-token.dto.js +46 -0
- package/lib/src/modules/access/dto/register-ca.dto.d.ts +16 -0
- package/lib/src/modules/access/dto/register-ca.dto.js +111 -0
- package/lib/src/modules/access/dto/ssh-key.dto.d.ts +20 -0
- package/lib/src/modules/access/dto/ssh-key.dto.js +124 -0
- package/lib/src/modules/access/dto/update-ssh-key.dto.d.ts +7 -0
- package/lib/src/modules/access/dto/update-ssh-key.dto.js +73 -0
- package/lib/src/modules/access/entities/api-token.entity.d.ts +30 -0
- package/lib/src/modules/access/entities/api-token.entity.js +87 -0
- package/lib/src/modules/access/entities/ca-keypair.entity.d.ts +13 -0
- package/lib/src/modules/access/entities/ca-keypair.entity.js +63 -0
- package/lib/src/modules/access/entities/credentials.entity.d.ts +18 -0
- package/lib/src/modules/access/entities/credentials.entity.js +87 -0
- package/lib/src/modules/access/entities/ssh-key.entity.d.ts +15 -0
- package/lib/src/modules/access/entities/ssh-key.entity.js +81 -0
- package/lib/src/modules/access/enums/credential-purpose.enum.d.ts +4 -0
- package/lib/src/modules/access/enums/credential-purpose.enum.js +8 -0
- package/lib/src/modules/access/interfaces/access.repository.d.ts +11 -0
- package/lib/src/modules/access/interfaces/access.repository.js +2 -0
- package/lib/src/modules/access/interfaces/ssh-key.interface.d.ts +26 -0
- package/lib/src/modules/access/interfaces/ssh-key.interface.js +2 -0
- package/lib/src/modules/access/mapper/api-token.mapper.d.ts +6 -0
- package/lib/src/modules/access/mapper/api-token.mapper.js +21 -0
- package/lib/src/modules/access/mapper/ssh-key.mapper.d.ts +6 -0
- package/lib/src/modules/access/mapper/ssh-key.mapper.js +25 -0
- package/lib/src/modules/access/providers/contabo-ssh-provider.service.d.ts +13 -0
- package/lib/src/modules/access/providers/contabo-ssh-provider.service.js +40 -0
- package/lib/src/modules/access/providers/hetzner-ssh-provider.service.d.ts +17 -0
- package/lib/src/modules/access/providers/hetzner-ssh-provider.service.js +95 -0
- package/lib/src/modules/access/providers/interfaces/ssh-provider.interface.d.ts +8 -0
- package/lib/src/modules/access/providers/interfaces/ssh-provider.interface.js +3 -0
- package/lib/src/modules/access/providers/ssh-provider.factory.d.ts +13 -0
- package/lib/src/modules/access/providers/ssh-provider.factory.js +44 -0
- package/lib/src/modules/access/repositories/api-token.repository.d.ts +24 -0
- package/lib/src/modules/access/repositories/api-token.repository.js +99 -0
- package/lib/src/modules/access/repositories/default-access.repository.d.ts +16 -0
- package/lib/src/modules/access/repositories/default-access.repository.js +121 -0
- package/lib/src/modules/access/repositories/provider-credentials.repository.d.ts +17 -0
- package/lib/src/modules/access/repositories/provider-credentials.repository.js +106 -0
- package/lib/src/modules/access/services/access.service.d.ts +180 -0
- package/lib/src/modules/access/services/access.service.js +732 -0
- package/lib/src/modules/access/services/bearerToken.service.d.ts +15 -0
- package/lib/src/modules/access/services/bearerToken.service.js +107 -0
- package/lib/src/modules/access/services/ca-manager.service.d.ts +48 -0
- package/lib/src/modules/access/services/ca-manager.service.js +293 -0
- package/lib/src/modules/access/services/certificate-signer.service.d.ts +36 -0
- package/lib/src/modules/access/services/certificate-signer.service.js +155 -0
- package/lib/src/modules/access/services/key-storage.service.d.ts +17 -0
- package/lib/src/modules/access/services/key-storage.service.js +133 -0
- package/lib/src/modules/access/services/ssh-key-generator.service.d.ts +6 -0
- package/lib/src/modules/access/services/ssh-key-generator.service.js +51 -0
- package/lib/src/modules/app-builds/entities/app-build.entity.d.ts +38 -0
- package/lib/src/modules/app-builds/entities/app-build.entity.js +168 -0
- package/lib/src/modules/app-builds/enums/app-build-status.enum.d.ts +10 -0
- package/lib/src/modules/app-builds/enums/app-build-status.enum.js +14 -0
- package/lib/src/modules/app-builds/enums/build-provider.enum.d.ts +6 -0
- package/lib/src/modules/app-builds/enums/build-provider.enum.js +10 -0
- package/lib/src/modules/app-builds/services/build-job.service.d.ts +178 -0
- package/lib/src/modules/app-builds/services/build-job.service.js +1057 -0
- package/lib/src/modules/applications/entities/app-resource.entity.d.ts +24 -0
- package/lib/src/modules/applications/entities/app-resource.entity.js +117 -0
- package/lib/src/modules/applications/entities/app-revision.entity.d.ts +29 -0
- package/lib/src/modules/applications/entities/app-revision.entity.js +133 -0
- package/lib/src/modules/applications/entities/application.entity.d.ts +121 -0
- package/lib/src/modules/applications/entities/application.entity.js +279 -0
- package/lib/src/modules/applications/enums/app-event-type.enum.d.ts +24 -0
- package/lib/src/modules/applications/enums/app-event-type.enum.js +28 -0
- package/lib/src/modules/applications/enums/application-category.enum.d.ts +4 -0
- package/lib/src/modules/applications/enums/application-category.enum.js +8 -0
- package/lib/src/modules/applications/enums/application-exposure.enum.d.ts +4 -0
- package/lib/src/modules/applications/enums/application-exposure.enum.js +8 -0
- package/lib/src/modules/applications/enums/application-kind.enum.d.ts +6 -0
- package/lib/src/modules/applications/enums/application-kind.enum.js +10 -0
- package/lib/src/modules/applications/enums/application-resource-kind.enum.d.ts +17 -0
- package/lib/src/modules/applications/enums/application-resource-kind.enum.js +21 -0
- package/lib/src/modules/applications/enums/application-resource-status.enum.d.ts +8 -0
- package/lib/src/modules/applications/enums/application-resource-status.enum.js +12 -0
- package/lib/src/modules/applications/enums/application-source-type.enum.d.ts +6 -0
- package/lib/src/modules/applications/enums/application-source-type.enum.js +10 -0
- package/lib/src/modules/applications/enums/application-status.enum.d.ts +20 -0
- package/lib/src/modules/applications/enums/application-status.enum.js +24 -0
- package/lib/src/modules/applications/interfaces/source-config.interface.d.ts +132 -0
- package/lib/src/modules/applications/interfaces/source-config.interface.js +2 -0
- package/lib/src/modules/auth/decorators/admin.decorator.d.ts +2 -0
- package/lib/src/modules/auth/decorators/admin.decorator.js +7 -0
- package/lib/src/modules/auth/entities/user.entity.d.ts +19 -0
- package/lib/src/modules/auth/entities/user.entity.js +78 -0
- package/lib/src/modules/auth/guards/admin.guard.d.ts +7 -0
- package/lib/src/modules/auth/guards/admin.guard.js +50 -0
- package/lib/src/modules/auth/interfaces/authenticated-user.interface.d.ts +12 -0
- package/lib/src/modules/auth/interfaces/authenticated-user.interface.js +2 -0
- package/lib/src/modules/common/cache/cache.service.d.ts +77 -0
- package/lib/src/modules/common/cache/cache.service.js +232 -0
- package/lib/src/modules/common/cache/cache.tokens.d.ts +1 -0
- package/lib/src/modules/common/cache/cache.tokens.js +4 -0
- package/lib/src/modules/common/cache/enums/cache-category.enum.d.ts +33 -0
- package/lib/src/modules/common/cache/enums/cache-category.enum.js +42 -0
- package/lib/src/modules/common/common.module.d.ts +2 -0
- package/lib/src/modules/common/common.module.js +20 -0
- package/lib/src/modules/common/dto/async-operation-response.dto.d.ts +19 -0
- package/lib/src/modules/common/dto/async-operation-response.dto.js +65 -0
- package/lib/src/modules/common/dto/index.d.ts +1 -0
- package/lib/src/modules/common/dto/index.js +17 -0
- package/lib/src/modules/common/services/label.service.d.ts +70 -0
- package/lib/src/modules/common/services/label.service.js +128 -0
- package/lib/src/modules/dns/entities/app-endpoint.entity.d.ts +57 -0
- package/lib/src/modules/dns/entities/app-endpoint.entity.js +205 -0
- package/lib/src/modules/dns/entities/cluster-dns-zone.entity.d.ts +21 -0
- package/lib/src/modules/dns/entities/cluster-dns-zone.entity.js +88 -0
- package/lib/src/modules/dns/entities/dns-zone.entity.d.ts +12 -0
- package/lib/src/modules/dns/entities/dns-zone.entity.js +53 -0
- package/lib/src/modules/dns/entities/san-certificate.entity.d.ts +29 -0
- package/lib/src/modules/dns/entities/san-certificate.entity.js +132 -0
- package/lib/src/modules/dns/entities/wildcard-certificate.entity.d.ts +26 -0
- package/lib/src/modules/dns/entities/wildcard-certificate.entity.js +111 -0
- package/lib/src/modules/dns/enums/cert-challenge.enum.d.ts +4 -0
- package/lib/src/modules/dns/enums/cert-challenge.enum.js +8 -0
- package/lib/src/modules/dns/enums/endpoint-type.enum.d.ts +4 -0
- package/lib/src/modules/dns/enums/endpoint-type.enum.js +8 -0
- package/lib/src/modules/dns/enums/hostname-mode.enum.d.ts +4 -0
- package/lib/src/modules/dns/enums/hostname-mode.enum.js +8 -0
- package/lib/src/modules/dns/services/cluster-dns-cleanup.service.d.ts +12 -0
- package/lib/src/modules/dns/services/cluster-dns-cleanup.service.js +79 -0
- package/lib/src/modules/dns/utils/nip-hostname.util.d.ts +12 -0
- package/lib/src/modules/dns/utils/nip-hostname.util.js +27 -0
- package/lib/src/modules/dns/utils/nip-token.util.d.ts +2 -0
- package/lib/src/modules/dns/utils/nip-token.util.js +94 -0
- package/lib/src/modules/frameworks/framework-core/enums/build-stage.enum.d.ts +21 -0
- package/lib/src/modules/frameworks/framework-core/enums/build-stage.enum.js +29 -0
- package/lib/src/modules/frameworks/framework-core/enums/deploy-strategy.enum.d.ts +22 -0
- package/lib/src/modules/frameworks/framework-core/enums/deploy-strategy.enum.js +26 -0
- package/lib/src/modules/frameworks/framework-core/enums/framework-type.enum.d.ts +32 -0
- package/lib/src/modules/frameworks/framework-core/enums/framework-type.enum.js +47 -0
- package/lib/src/modules/grafana/services/grafana-config.service.d.ts +43 -0
- package/lib/src/modules/grafana/services/grafana-config.service.js +177 -0
- package/lib/src/modules/grafana/services/grafana-datasource.service.d.ts +70 -0
- package/lib/src/modules/grafana/services/grafana-datasource.service.js +333 -0
- package/lib/src/modules/infrastructure/clusters/clusters.service.d.ts +126 -0
- package/lib/src/modules/infrastructure/clusters/clusters.service.js +265 -0
- package/lib/src/modules/infrastructure/clusters/constants/storage-conventions.d.ts +60 -0
- package/lib/src/modules/infrastructure/clusters/constants/storage-conventions.js +64 -0
- package/lib/src/modules/infrastructure/clusters/dto/build-resources.dto.d.ts +19 -0
- package/lib/src/modules/infrastructure/clusters/dto/build-resources.dto.js +69 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-capacity-plan.dto.d.ts +36 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-capacity-plan.dto.js +149 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-power-management.dto.d.ts +51 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-power-management.dto.js +222 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-response.dto.d.ts +42 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-response.dto.js +238 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-storage.dto.d.ts +35 -0
- package/lib/src/modules/infrastructure/clusters/dto/cluster-storage.dto.js +122 -0
- package/lib/src/modules/infrastructure/clusters/dto/create-cluster.dto.d.ts +43 -0
- package/lib/src/modules/infrastructure/clusters/dto/create-cluster.dto.js +334 -0
- package/lib/src/modules/infrastructure/clusters/dto/register-cluster.dto.d.ts +30 -0
- package/lib/src/modules/infrastructure/clusters/dto/register-cluster.dto.js +190 -0
- package/lib/src/modules/infrastructure/clusters/dto/resource-availability.dto.d.ts +15 -0
- package/lib/src/modules/infrastructure/clusters/dto/resource-availability.dto.js +91 -0
- package/lib/src/modules/infrastructure/clusters/entities/cluster-node.entity.d.ts +28 -0
- package/lib/src/modules/infrastructure/clusters/entities/cluster-node.entity.js +104 -0
- package/lib/src/modules/infrastructure/clusters/entities/cluster.entity.d.ts +64 -0
- package/lib/src/modules/infrastructure/clusters/entities/cluster.entity.js +199 -0
- package/lib/src/modules/infrastructure/clusters/entities/node-billable-interval.entity.d.ts +17 -0
- package/lib/src/modules/infrastructure/clusters/entities/node-billable-interval.entity.js +86 -0
- package/lib/src/modules/infrastructure/clusters/entities/volume-billable-interval.entity.d.ts +18 -0
- package/lib/src/modules/infrastructure/clusters/entities/volume-billable-interval.entity.js +79 -0
- package/lib/src/modules/infrastructure/clusters/services/billing-intervals.service.d.ts +48 -0
- package/lib/src/modules/infrastructure/clusters/services/billing-intervals.service.js +159 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-capacity.service.d.ts +23 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-capacity.service.js +198 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-creation.service.d.ts +25 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-creation.service.js +192 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-deletion.service.d.ts +36 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-deletion.service.js +159 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-firewall-integration.service.d.ts +25 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-firewall-integration.service.js +90 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-mapper.service.d.ts +15 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-mapper.service.js +63 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-node-scaling.service.d.ts +78 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-node-scaling.service.js +644 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-operations.service.d.ts +37 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-operations.service.js +244 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-power-management.service.d.ts +68 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-power-management.service.js +716 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-storage.service.d.ts +15 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-storage.service.js +179 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-validation.service.d.ts +29 -0
- package/lib/src/modules/infrastructure/clusters/services/cluster-validation.service.js +100 -0
- package/lib/src/modules/infrastructure/firewalls/dto/cluster-firewall.dto.d.ts +62 -0
- package/lib/src/modules/infrastructure/firewalls/dto/cluster-firewall.dto.js +252 -0
- package/lib/src/modules/infrastructure/firewalls/entities/cluster-firewall.entity.d.ts +20 -0
- package/lib/src/modules/infrastructure/firewalls/entities/cluster-firewall.entity.js +83 -0
- package/lib/src/modules/infrastructure/firewalls/services/firewall-desired-state.service.d.ts +73 -0
- package/lib/src/modules/infrastructure/firewalls/services/firewall-desired-state.service.js +329 -0
- package/lib/src/modules/infrastructure/firewalls/services/firewall-reconciliation.service.d.ts +43 -0
- package/lib/src/modules/infrastructure/firewalls/services/firewall-reconciliation.service.js +212 -0
- package/lib/src/modules/infrastructure/firewalls/templates/firewall-rules.template.d.ts +54 -0
- package/lib/src/modules/infrastructure/firewalls/templates/firewall-rules.template.js +167 -0
- package/lib/src/modules/infrastructure/operations/helpers/operation-steps.helper.d.ts +34 -0
- package/lib/src/modules/infrastructure/operations/helpers/operation-steps.helper.js +401 -0
- package/lib/src/modules/infrastructure/servers/dto/create-server.dto.d.ts +40 -0
- package/lib/src/modules/infrastructure/servers/dto/create-server.dto.js +157 -0
- package/lib/src/modules/infrastructure/servers/dto/delete-server.dto.d.ts +17 -0
- package/lib/src/modules/infrastructure/servers/dto/delete-server.dto.js +85 -0
- package/lib/src/modules/infrastructure/servers/dto/server-response.dto.d.ts +29 -0
- package/lib/src/modules/infrastructure/servers/dto/server-response.dto.js +147 -0
- package/lib/src/modules/infrastructure/servers/entities/infrastructure-operations.entity.d.ts +266 -0
- package/lib/src/modules/infrastructure/servers/entities/infrastructure-operations.entity.js +348 -0
- package/lib/src/modules/infrastructure/shared/enums/reconciliation-status.enum.d.ts +7 -0
- package/lib/src/modules/infrastructure/shared/enums/reconciliation-status.enum.js +11 -0
- package/lib/src/modules/infrastructure/shared/services/kubernetes.service.d.ts +304 -0
- package/lib/src/modules/infrastructure/shared/services/kubernetes.service.js +1164 -0
- package/lib/src/modules/infrastructure/shared/services/label.service.d.ts +97 -0
- package/lib/src/modules/infrastructure/shared/services/label.service.js +189 -0
- package/lib/src/modules/infrastructure/shared/shared-infrastructure.module.d.ts +2 -0
- package/lib/src/modules/infrastructure/shared/shared-infrastructure.module.js +24 -0
- package/lib/src/modules/infrastructure/vnets/entities/vnet-route.entity.d.ts +10 -0
- package/lib/src/modules/infrastructure/vnets/entities/vnet-route.entity.js +51 -0
- package/lib/src/modules/infrastructure/vnets/entities/vnet-subnet.entity.d.ts +20 -0
- package/lib/src/modules/infrastructure/vnets/entities/vnet-subnet.entity.js +77 -0
- package/lib/src/modules/infrastructure/vnets/entities/vnet.entity.d.ts +28 -0
- package/lib/src/modules/infrastructure/vnets/entities/vnet.entity.js +88 -0
- package/lib/src/modules/instances/entities/instance-status.enum.d.ts +12 -0
- package/lib/src/modules/instances/entities/instance-status.enum.js +16 -0
- package/lib/src/modules/instances/entities/instance-type.enum.d.ts +6 -0
- package/lib/src/modules/instances/entities/instance-type.enum.js +10 -0
- package/lib/src/modules/instances/entities/instance.entity.d.ts +41 -0
- package/lib/src/modules/instances/entities/instance.entity.js +126 -0
- package/lib/src/modules/management/dto/configure-provider.dto.d.ts +8 -0
- package/lib/src/modules/management/dto/configure-provider.dto.js +51 -0
- package/lib/src/modules/management/dto/credentials.dto.d.ts +15 -0
- package/lib/src/modules/management/dto/credentials.dto.js +114 -0
- package/lib/src/modules/management/dto/health-status.dto.d.ts +12 -0
- package/lib/src/modules/management/dto/health-status.dto.js +40 -0
- package/lib/src/modules/management/dto/node-size-option.dto.d.ts +37 -0
- package/lib/src/modules/management/dto/node-size-option.dto.js +178 -0
- package/lib/src/modules/management/dto/pricing-query.dto.d.ts +5 -0
- package/lib/src/modules/management/dto/pricing-query.dto.js +36 -0
- package/lib/src/modules/management/dto/pricing-response.dto.d.ts +21 -0
- package/lib/src/modules/management/dto/pricing-response.dto.js +80 -0
- package/lib/src/modules/management/dto/provider-configuration.dto.d.ts +23 -0
- package/lib/src/modules/management/dto/provider-configuration.dto.js +72 -0
- package/lib/src/modules/management/dto/provider-filters.dto.d.ts +7 -0
- package/lib/src/modules/management/dto/provider-filters.dto.js +45 -0
- package/lib/src/modules/management/dto/validation-result.dto.d.ts +16 -0
- package/lib/src/modules/management/dto/validation-result.dto.js +35 -0
- package/lib/src/modules/management/entities/credentials.entity.d.ts +21 -0
- package/lib/src/modules/management/entities/credentials.entity.js +10 -0
- package/lib/src/modules/management/entities/provider-capabilities.entity.d.ts +85 -0
- package/lib/src/modules/management/entities/provider-capabilities.entity.js +2 -0
- package/lib/src/modules/management/entities/provider-configuration.entity.d.ts +14 -0
- package/lib/src/modules/management/entities/provider-configuration.entity.js +65 -0
- package/lib/src/modules/management/entities/provider-definition.entity.d.ts +19 -0
- package/lib/src/modules/management/entities/provider-definition.entity.js +2 -0
- package/lib/src/modules/management/entities/provider-region.entity.d.ts +11 -0
- package/lib/src/modules/management/entities/provider-region.entity.js +2 -0
- package/lib/src/modules/management/entities/provider-status.enum.d.ts +8 -0
- package/lib/src/modules/management/entities/provider-status.enum.js +12 -0
- package/lib/src/modules/management/interfaces/provider-configuration.repository.interface.d.ts +17 -0
- package/lib/src/modules/management/interfaces/provider-configuration.repository.interface.js +2 -0
- package/lib/src/modules/management/repositories/provider-configuration.repository.d.ts +21 -0
- package/lib/src/modules/management/repositories/provider-configuration.repository.js +89 -0
- package/lib/src/modules/management/services/configuration-mode.service.d.ts +20 -0
- package/lib/src/modules/management/services/configuration-mode.service.js +54 -0
- package/lib/src/modules/management/services/management.service.d.ts +72 -0
- package/lib/src/modules/management/services/management.service.js +546 -0
- package/lib/src/modules/management/services/provider-definitions.service.d.ts +26 -0
- package/lib/src/modules/management/services/provider-definitions.service.js +133 -0
- package/lib/src/modules/providers/controllers/provider-firewalls.controller.d.ts +28 -0
- package/lib/src/modules/providers/controllers/provider-firewalls.controller.js +277 -0
- package/lib/src/modules/providers/core/factories/capabilities-provider.factory.d.ts +10 -0
- package/lib/src/modules/providers/core/factories/capabilities-provider.factory.js +39 -0
- package/lib/src/modules/providers/core/factories/certificate-provider.factory.d.ts +11 -0
- package/lib/src/modules/providers/core/factories/certificate-provider.factory.js +58 -0
- package/lib/src/modules/providers/core/factories/dns-provider.factory.d.ts +12 -0
- package/lib/src/modules/providers/core/factories/dns-provider.factory.js +65 -0
- package/lib/src/modules/providers/core/factories/firewall-provider.factory.d.ts +12 -0
- package/lib/src/modules/providers/core/factories/firewall-provider.factory.js +61 -0
- package/lib/src/modules/providers/core/factories/provider.factory.d.ts +9 -0
- package/lib/src/modules/providers/core/factories/provider.factory.js +47 -0
- package/lib/src/modules/providers/core/factories/vm-backup-provider.factory.d.ts +12 -0
- package/lib/src/modules/providers/core/factories/vm-backup-provider.factory.js +56 -0
- package/lib/src/modules/providers/core/factories/volume-export.factory.d.ts +12 -0
- package/lib/src/modules/providers/core/factories/volume-export.factory.js +56 -0
- package/lib/src/modules/providers/core/interfaces/certificate-provider.interface.d.ts +1 -0
- package/lib/src/modules/providers/core/interfaces/certificate-provider.interface.js +17 -0
- package/lib/src/modules/providers/core/interfaces/cloud-provider.interface.d.ts +1 -0
- package/lib/src/modules/providers/core/interfaces/cloud-provider.interface.js +17 -0
- package/lib/src/modules/providers/core/interfaces/dns-provider.interface.d.ts +1 -0
- package/lib/src/modules/providers/core/interfaces/dns-provider.interface.js +17 -0
- package/lib/src/modules/providers/core/interfaces/firewall-provider.interface.d.ts +1 -0
- package/lib/src/modules/providers/core/interfaces/firewall-provider.interface.js +17 -0
- package/lib/src/modules/providers/core/interfaces/provider-bootstrap-seeder.interface.d.ts +54 -0
- package/lib/src/modules/providers/core/interfaces/provider-bootstrap-seeder.interface.js +2 -0
- package/lib/src/modules/providers/core/tokens.d.ts +59 -0
- package/lib/src/modules/providers/core/tokens.js +19 -0
- package/lib/src/modules/providers/data/region-coordinates.d.ts +6 -0
- package/lib/src/modules/providers/data/region-coordinates.js +25 -0
- package/lib/src/modules/providers/dto/firewall.dto.d.ts +30 -0
- package/lib/src/modules/providers/dto/firewall.dto.js +105 -0
- package/lib/src/modules/providers/dto/node-size.dto.d.ts +46 -0
- package/lib/src/modules/providers/dto/node-size.dto.js +22 -0
- package/lib/src/modules/providers/dto/pricing.dto.d.ts +24 -0
- package/lib/src/modules/providers/dto/pricing.dto.js +19 -0
- package/lib/src/modules/providers/dto/provider-firewall-response.dto.d.ts +28 -0
- package/lib/src/modules/providers/dto/provider-firewall-response.dto.js +134 -0
- package/lib/src/modules/providers/enums/certificate-provider.enum.d.ts +4 -0
- package/lib/src/modules/providers/enums/certificate-provider.enum.js +8 -0
- package/lib/src/modules/providers/enums/cloud-provider.enum.d.ts +5 -0
- package/lib/src/modules/providers/enums/cloud-provider.enum.js +9 -0
- package/lib/src/modules/providers/enums/dns-provider.enum.d.ts +5 -0
- package/lib/src/modules/providers/enums/dns-provider.enum.js +9 -0
- package/lib/src/modules/providers/implementations/contabo/contabo-capabilities.service.d.ts +19 -0
- package/lib/src/modules/providers/implementations/contabo/contabo-capabilities.service.js +254 -0
- package/lib/src/modules/providers/implementations/contabo/contabo-provider.module.d.ts +10 -0
- package/lib/src/modules/providers/implementations/contabo/contabo-provider.module.js +72 -0
- package/lib/src/modules/providers/implementations/contabo/generated/api.d.ts +13374 -0
- package/lib/src/modules/providers/implementations/contabo/generated/api.js +11341 -0
- package/lib/src/modules/providers/implementations/contabo/generated/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/contabo/generated/base.js +66 -0
- package/lib/src/modules/providers/implementations/contabo/generated/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/contabo/generated/common.js +152 -0
- package/lib/src/modules/providers/implementations/contabo/generated/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/contabo/generated/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/contabo/generated/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/contabo/generated/index.js +31 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/api.d.ts +18419 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/api.js +19133 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/base.js +66 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/common.js +152 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/hetzner/generated/index.js +31 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-bootstrap-seeder.service.d.ts +19 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-bootstrap-seeder.service.js +68 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-capabilities.service.d.ts +29 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-capabilities.service.js +392 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-provider.module.d.ts +2 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-provider.module.js +81 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-volume-operations.service.d.ts +31 -0
- package/lib/src/modules/providers/implementations/hetzner/hetzner-volume-operations.service.js +312 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage-connection.controller.d.ts +18 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage-connection.controller.js +67 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage-connection.service.d.ts +24 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage-connection.service.js +107 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage.backend.d.ts +7 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage.backend.js +35 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage.module.d.ts +8 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage.module.js +60 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage.provisioner.d.ts +22 -0
- package/lib/src/modules/providers/implementations/hetzner/object-storage/hetzner-object-storage.provisioner.js +100 -0
- package/lib/src/modules/providers/implementations/hetzner/vm-backup/hetzner-vm-backup.service.d.ts +20 -0
- package/lib/src/modules/providers/implementations/hetzner/vm-backup/hetzner-vm-backup.service.js +118 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/api.d.ts +4227 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/api.js +3362 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/base.js +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/common.js +152 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/baremetal/index.js +31 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/api.d.ts +2486 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/api.js +2424 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/base.js +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/common.js +152 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/domain/index.js +31 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/api.d.ts +6425 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/api.js +6925 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/base.js +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/common.js +152 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/iam/index.js +31 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/api.d.ts +11187 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/api.js +9264 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/base.js +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/common.js +152 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/instances/index.js +31 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/api.d.ts +492 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/api.js +531 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/base.js +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/common.js +152 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/private-network/index.js +31 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/api.d.ts +2305 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/api.js +2443 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/base.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/base.js +66 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/common.d.ts +65 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/common.js +152 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/configuration.d.ts +91 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/configuration.js +50 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/index.d.ts +13 -0
- package/lib/src/modules/providers/implementations/scaleway/generated/vpc/index.js +31 -0
- package/lib/src/modules/providers/implementations/scaleway/object-storage/scaleway-object-storage.backend.d.ts +8 -0
- package/lib/src/modules/providers/implementations/scaleway/object-storage/scaleway-object-storage.backend.js +49 -0
- package/lib/src/modules/providers/implementations/scaleway/object-storage/scaleway-object-storage.module.d.ts +9 -0
- package/lib/src/modules/providers/implementations/scaleway/object-storage/scaleway-object-storage.module.js +56 -0
- package/lib/src/modules/providers/implementations/scaleway/object-storage/scaleway-object-storage.provisioner.d.ts +27 -0
- package/lib/src/modules/providers/implementations/scaleway/object-storage/scaleway-object-storage.provisioner.js +120 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-baremetal.adapter.d.ts +22 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-baremetal.adapter.js +140 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-bootstrap-seeder.service.d.ts +12 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-bootstrap-seeder.service.js +65 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-capabilities.service.d.ts +23 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-capabilities.service.js +319 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-dns.service.d.ts +24 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-dns.service.js +189 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-firewall.service.d.ts +43 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-firewall.service.js +455 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-iam.adapter.d.ts +32 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-iam.adapter.js +108 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-instances.adapter.d.ts +66 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-instances.adapter.js +289 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-provider.module.d.ts +17 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-provider.module.js +122 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-provider.service.d.ts +100 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-provider.service.js +1395 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-volume-operations.service.d.ts +24 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-volume-operations.service.js +199 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-vpc.adapter.d.ts +30 -0
- package/lib/src/modules/providers/implementations/scaleway/scaleway-vpc.adapter.js +180 -0
- package/lib/src/modules/providers/index.d.ts +17 -0
- package/lib/src/modules/providers/index.js +39 -0
- package/lib/src/modules/providers/interfaces/certificate-provider.interface.d.ts +38 -0
- package/lib/src/modules/providers/interfaces/certificate-provider.interface.js +11 -0
- package/lib/src/modules/providers/interfaces/cloud-provider.interface.d.ts +215 -0
- package/lib/src/modules/providers/interfaces/cloud-provider.interface.js +2 -0
- package/lib/src/modules/providers/interfaces/credential-provider.interface.d.ts +23 -0
- package/lib/src/modules/providers/interfaces/credential-provider.interface.js +2 -0
- package/lib/src/modules/providers/interfaces/dns-provider.interface.d.ts +55 -0
- package/lib/src/modules/providers/interfaces/dns-provider.interface.js +12 -0
- package/lib/src/modules/providers/interfaces/firewall-provider.interface.d.ts +47 -0
- package/lib/src/modules/providers/interfaces/firewall-provider.interface.js +2 -0
- package/lib/src/modules/providers/interfaces/network-provider.interface.d.ts +124 -0
- package/lib/src/modules/providers/interfaces/network-provider.interface.js +2 -0
- package/lib/src/modules/providers/interfaces/provider-capabilities.interface.d.ts +87 -0
- package/lib/src/modules/providers/interfaces/provider-capabilities.interface.js +2 -0
- package/lib/src/modules/providers/interfaces/vm-backup-provider.interface.d.ts +39 -0
- package/lib/src/modules/providers/interfaces/vm-backup-provider.interface.js +8 -0
- package/lib/src/modules/providers/interfaces/volume-export.interface.d.ts +162 -0
- package/lib/src/modules/providers/interfaces/volume-export.interface.js +21 -0
- package/lib/src/modules/providers/interfaces/volume-operations.interface.d.ts +149 -0
- package/lib/src/modules/providers/interfaces/volume-operations.interface.js +17 -0
- package/lib/src/modules/providers/mappers/node-size.mapper.d.ts +20 -0
- package/lib/src/modules/providers/mappers/node-size.mapper.js +75 -0
- package/lib/src/modules/providers/mappers/pricing.mapper.d.ts +14 -0
- package/lib/src/modules/providers/mappers/pricing.mapper.js +60 -0
- package/lib/src/modules/providers/provider-core.module.d.ts +13 -0
- package/lib/src/modules/providers/provider-core.module.js +59 -0
- package/lib/src/modules/providers/providers.module.d.ts +2 -0
- package/lib/src/modules/providers/providers.module.js +188 -0
- package/lib/src/modules/providers/services/acme-certificate.service.d.ts +38 -0
- package/lib/src/modules/providers/services/acme-certificate.service.js +144 -0
- package/lib/src/modules/providers/services/contabo-firewall.service.d.ts +11 -0
- package/lib/src/modules/providers/services/contabo-firewall.service.js +40 -0
- package/lib/src/modules/providers/services/contabo-provider.service.d.ts +48 -0
- package/lib/src/modules/providers/services/contabo-provider.service.js +194 -0
- package/lib/src/modules/providers/services/credential-provider.service.d.ts +17 -0
- package/lib/src/modules/providers/services/credential-provider.service.js +78 -0
- package/lib/src/modules/providers/services/dns-provider.factory.d.ts +5 -0
- package/lib/src/modules/providers/services/dns-provider.factory.js +9 -0
- package/lib/src/modules/providers/services/firewall-provider.factory.d.ts +5 -0
- package/lib/src/modules/providers/services/firewall-provider.factory.js +9 -0
- package/lib/src/modules/providers/services/hetzner-dns.service.d.ts +71 -0
- package/lib/src/modules/providers/services/hetzner-dns.service.js +565 -0
- package/lib/src/modules/providers/services/hetzner-firewall.service.d.ts +48 -0
- package/lib/src/modules/providers/services/hetzner-firewall.service.js +472 -0
- package/lib/src/modules/providers/services/hetzner-network.service.d.ts +84 -0
- package/lib/src/modules/providers/services/hetzner-network.service.js +408 -0
- package/lib/src/modules/providers/services/hetzner-provider.service.d.ts +213 -0
- package/lib/src/modules/providers/services/hetzner-provider.service.js +1159 -0
- package/lib/src/modules/providers/services/provider.factory.d.ts +5 -0
- package/lib/src/modules/providers/services/provider.factory.js +9 -0
- package/lib/src/modules/providers/services/volume-export.service.d.ts +50 -0
- package/lib/src/modules/providers/services/volume-export.service.js +650 -0
- package/lib/src/modules/shared/encryption/encryption.module.d.ts +2 -0
- package/lib/src/modules/shared/encryption/encryption.module.js +22 -0
- package/lib/src/modules/shared/encryption/services/encryption.service.d.ts +47 -0
- package/lib/src/modules/shared/encryption/services/encryption.service.js +199 -0
- package/lib/src/modules/storage/enums/storage-backend-provider.enum.d.ts +19 -0
- package/lib/src/modules/storage/enums/storage-backend-provider.enum.js +23 -0
- package/lib/src/modules/storage/factories/object-storage-provisioner.factory.d.ts +11 -0
- package/lib/src/modules/storage/factories/object-storage-provisioner.factory.js +48 -0
- package/lib/src/modules/storage/factories/storage-backend.factory.d.ts +12 -0
- package/lib/src/modules/storage/factories/storage-backend.factory.js +51 -0
- package/lib/src/modules/storage/implementations/generic-s3.backend.d.ts +23 -0
- package/lib/src/modules/storage/implementations/generic-s3.backend.js +172 -0
- package/lib/src/modules/storage/interfaces/backup-storage-backend.interface.d.ts +48 -0
- package/lib/src/modules/storage/interfaces/backup-storage-backend.interface.js +2 -0
- package/lib/src/modules/storage/interfaces/object-storage-provisioner.interface.d.ts +55 -0
- package/lib/src/modules/storage/interfaces/object-storage-provisioner.interface.js +9 -0
- package/lib/src/modules/storage/storage.module.d.ts +2 -0
- package/lib/src/modules/storage/storage.module.js +21 -0
- package/lib/src/modules/storage/tokens/object-storage-provisioner-registry.token.d.ts +12 -0
- package/lib/src/modules/storage/tokens/object-storage-provisioner-registry.token.js +8 -0
- package/lib/src/modules/storage/tokens/storage-backend-registry.token.d.ts +12 -0
- package/lib/src/modules/storage/tokens/storage-backend-registry.token.js +8 -0
- package/lib/src/modules/terminal/services/native-ssh-connection.service.d.ts +48 -0
- package/lib/src/modules/terminal/services/native-ssh-connection.service.js +282 -0
- package/oclif.manifest.json +5243 -0
- package/package.json +125 -0
|
@@ -0,0 +1,1057 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var BuildJobService_1;
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.BuildJobService = exports.BUILD_JOB_MEMORY_REQUEST = exports.BUILD_JOB_CPU_REQUEST = exports.BUILD_CACHE_PVC_NAME = exports.BUILD_RUNNER_IMAGE = exports.BUILD_NAMESPACE = void 0;
|
|
47
|
+
const common_1 = require("@nestjs/common");
|
|
48
|
+
const config_1 = require("@nestjs/config");
|
|
49
|
+
const https = __importStar(require("node:https"));
|
|
50
|
+
const kubernetes_service_1 = require("../../infrastructure/shared/services/kubernetes.service");
|
|
51
|
+
const deploy_strategy_enum_1 = require("../../frameworks/framework-core/enums/deploy-strategy.enum");
|
|
52
|
+
exports.BUILD_NAMESPACE = 'flui-build';
|
|
53
|
+
exports.BUILD_RUNNER_IMAGE = 'ghcr.io/dawit-io/flui-build-runner:railpack-0.22.2';
|
|
54
|
+
exports.BUILD_CACHE_PVC_NAME = 'flui-buildkit-cache';
|
|
55
|
+
/** Total CPU request (millicores) for a single build Job (git-clone + railpack + buildkitd) */
|
|
56
|
+
exports.BUILD_JOB_CPU_REQUEST = 800;
|
|
57
|
+
/** Total memory request (Mi) for a single build Job */
|
|
58
|
+
exports.BUILD_JOB_MEMORY_REQUEST = 896;
|
|
59
|
+
let BuildJobService = BuildJobService_1 = class BuildJobService {
|
|
60
|
+
constructor(kubernetesService, configService) {
|
|
61
|
+
this.kubernetesService = kubernetesService;
|
|
62
|
+
this.configService = configService;
|
|
63
|
+
this.logger = new common_1.Logger(BuildJobService_1.name);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Ensure the flui-build namespace exists with the correct PSA labels.
|
|
67
|
+
* Uses server-side apply so labels are always patched even if namespace already exists.
|
|
68
|
+
*/
|
|
69
|
+
async ensureBuildNamespace(kubeconfig) {
|
|
70
|
+
const manifest = `
|
|
71
|
+
apiVersion: v1
|
|
72
|
+
kind: Namespace
|
|
73
|
+
metadata:
|
|
74
|
+
name: ${exports.BUILD_NAMESPACE}
|
|
75
|
+
labels:
|
|
76
|
+
managed-by: flui-cloud
|
|
77
|
+
flui.cloud/tier: build
|
|
78
|
+
pod-security.kubernetes.io/enforce: privileged
|
|
79
|
+
pod-security.kubernetes.io/enforce-version: latest
|
|
80
|
+
`;
|
|
81
|
+
await this.kubernetesService.applyManifest(kubeconfig, manifest);
|
|
82
|
+
this.logger.debug(`Namespace ${exports.BUILD_NAMESPACE} ensured with PSA labels`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Create or update the ghcr-push-secret in the flui-build namespace.
|
|
86
|
+
* Contains:
|
|
87
|
+
* - dockerconfig: Docker config.json for ghcr.io authentication
|
|
88
|
+
* - github_token: plaintext token for git clone via HTTPS
|
|
89
|
+
*/
|
|
90
|
+
async ensureGhcrSecret(kubeconfig, githubUsername, githubToken) {
|
|
91
|
+
const authBase64 = Buffer.from(`${githubUsername}:${githubToken}`).toString('base64');
|
|
92
|
+
const dockerConfig = JSON.stringify({
|
|
93
|
+
auths: {
|
|
94
|
+
'ghcr.io': { auth: authBase64 },
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
// Opaque secret — used as volume mount (dockerconfig key) and git clone token
|
|
98
|
+
await this.kubernetesService.patchSecret(kubeconfig, exports.BUILD_NAMESPACE, 'ghcr-push-secret', {
|
|
99
|
+
dockerconfig: dockerConfig,
|
|
100
|
+
github_token: githubToken,
|
|
101
|
+
});
|
|
102
|
+
// kubernetes.io/dockerconfigjson secret — used as imagePullSecret for the build runner image
|
|
103
|
+
const dockerConfigJsonBase64 = Buffer.from(dockerConfig).toString('base64');
|
|
104
|
+
const pullSecretManifest = [
|
|
105
|
+
'apiVersion: v1',
|
|
106
|
+
'kind: Secret',
|
|
107
|
+
'metadata:',
|
|
108
|
+
' name: ghcr-runner-pull-secret',
|
|
109
|
+
` namespace: ${exports.BUILD_NAMESPACE}`,
|
|
110
|
+
'type: kubernetes.io/dockerconfigjson',
|
|
111
|
+
'data:',
|
|
112
|
+
` .dockerconfigjson: ${dockerConfigJsonBase64}`,
|
|
113
|
+
].join('\n');
|
|
114
|
+
await this.kubernetesService.applyManifest(kubeconfig, pullSecretManifest);
|
|
115
|
+
this.logger.log(`ghcr secrets updated in namespace ${exports.BUILD_NAMESPACE} for user ${githubUsername}`);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Ensure the flui-buildkit-cache PVC exists in the flui-build namespace.
|
|
119
|
+
* Mounts at /var/lib/buildkit in the buildkitd container to persist BuildKit's
|
|
120
|
+
* content-addressable store across Jobs. This covers all package manager caches
|
|
121
|
+
* (pnpm, NuGet, Maven, Gradle, pip, etc.) via railpack's RUN --mount=type=cache directives.
|
|
122
|
+
*/
|
|
123
|
+
async ensureBuildCachePvc(kubeconfig) {
|
|
124
|
+
const storage = this.configService.get('BUILD_CACHE_PVC_STORAGE', '20Gi');
|
|
125
|
+
const storageClass = this.configService.get('BUILD_CACHE_STORAGE_CLASS', 'local-path');
|
|
126
|
+
const manifest = `
|
|
127
|
+
apiVersion: v1
|
|
128
|
+
kind: PersistentVolumeClaim
|
|
129
|
+
metadata:
|
|
130
|
+
name: ${exports.BUILD_CACHE_PVC_NAME}
|
|
131
|
+
namespace: ${exports.BUILD_NAMESPACE}
|
|
132
|
+
labels:
|
|
133
|
+
managed-by: flui-cloud
|
|
134
|
+
flui.cloud/purpose: buildkit-cache
|
|
135
|
+
spec:
|
|
136
|
+
accessModes:
|
|
137
|
+
- ReadWriteOnce
|
|
138
|
+
storageClassName: ${storageClass}
|
|
139
|
+
resources:
|
|
140
|
+
requests:
|
|
141
|
+
storage: ${storage}
|
|
142
|
+
`;
|
|
143
|
+
await this.kubernetesService.applyManifest(kubeconfig, manifest);
|
|
144
|
+
this.logger.debug(`BuildKit cache PVC ${exports.BUILD_CACHE_PVC_NAME} ensured (${storage}, ${storageClass})`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Delete the flui-buildkit-cache PVC. Used by cache-clear operations.
|
|
148
|
+
* Deletion is permanent — the underlying volume data is wiped.
|
|
149
|
+
*/
|
|
150
|
+
async deleteBuildCachePvc(kubeconfig) {
|
|
151
|
+
await this.kubernetesService.deleteResource(kubeconfig, 'PersistentVolumeClaim', exports.BUILD_CACHE_PVC_NAME, exports.BUILD_NAMESPACE);
|
|
152
|
+
this.logger.log(`BuildKit cache PVC ${exports.BUILD_CACHE_PVC_NAME} deleted`);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Return metadata about the flui-buildkit-cache PVC from the Kubernetes API.
|
|
156
|
+
* Returns null if the PVC does not exist.
|
|
157
|
+
*/
|
|
158
|
+
async getBuildCachePvcInfo(kubeconfig) {
|
|
159
|
+
const pvc = await this.kubernetesService.getResource(kubeconfig, 'PersistentVolumeClaim', exports.BUILD_CACHE_PVC_NAME, exports.BUILD_NAMESPACE);
|
|
160
|
+
if (!pvc) {
|
|
161
|
+
return {
|
|
162
|
+
exists: false,
|
|
163
|
+
phase: null,
|
|
164
|
+
capacity: null,
|
|
165
|
+
storageClass: null,
|
|
166
|
+
createdAt: null,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
exists: true,
|
|
171
|
+
phase: pvc.status?.phase ?? null,
|
|
172
|
+
capacity: pvc.status?.capacity?.storage ??
|
|
173
|
+
pvc.spec?.resources?.requests?.storage ??
|
|
174
|
+
null,
|
|
175
|
+
storageClass: pvc.spec?.storageClassName ?? null,
|
|
176
|
+
createdAt: pvc.metadata?.creationTimestamp
|
|
177
|
+
? new Date(pvc.metadata.creationTimestamp)
|
|
178
|
+
: null,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Build the image reference for the build.
|
|
183
|
+
* Format: ghcr.io/{githubUsername}/{appName}:{branch}-{shortSha}
|
|
184
|
+
* appName is derived from appSlug stripping any trailing branch/random suffix
|
|
185
|
+
* so the ghcr.io package name stays stable across branches and rebuilds.
|
|
186
|
+
*/
|
|
187
|
+
buildImageRef(githubUsername, appSlug, commitSha, branch, suffix) {
|
|
188
|
+
const shortSha = commitSha
|
|
189
|
+
? commitSha.substring(0, 8)
|
|
190
|
+
: Date.now().toString(36);
|
|
191
|
+
const safeBranch = (branch ?? 'main')
|
|
192
|
+
.toLowerCase()
|
|
193
|
+
.replaceAll(/[^a-z0-9-]/g, '-');
|
|
194
|
+
return `ghcr.io/${githubUsername}/${appSlug}:${safeBranch}-${shortSha}${suffix ?? ''}`;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Generate a DNS-safe K8s Job name from the app slug and commit SHA.
|
|
198
|
+
* Ensures max 63 chars (K8s name limit).
|
|
199
|
+
*/
|
|
200
|
+
buildJobName(appSlug, commitSha, suffix) {
|
|
201
|
+
const shortSha = commitSha
|
|
202
|
+
? commitSha.substring(0, 8)
|
|
203
|
+
: Date.now().toString(36);
|
|
204
|
+
const base = `flui-build-${appSlug}-${shortSha}${suffix ?? ''}`;
|
|
205
|
+
return base
|
|
206
|
+
.substring(0, 63)
|
|
207
|
+
.toLowerCase()
|
|
208
|
+
.replaceAll(/[^a-z0-9-]/g, '-');
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Apply the K3s build Job manifest to the cluster.
|
|
212
|
+
* Returns the job name applied.
|
|
213
|
+
*/
|
|
214
|
+
async createBuildJob(kubeconfig, config) {
|
|
215
|
+
const { build, app, repoOwner, repoName, imageRef, noCache } = config;
|
|
216
|
+
const sourceConfig = app.sourceConfig;
|
|
217
|
+
const branch = sourceConfig?.branch || build.branch;
|
|
218
|
+
const noCacheFlag = noCache ? '\\\n --no-cache' : '';
|
|
219
|
+
const strategy = config.deployStrategy ?? deploy_strategy_enum_1.DeployStrategy.RAILPACK_DIRECT;
|
|
220
|
+
const useDockerfile = strategy === deploy_strategy_enum_1.DeployStrategy.DOCKERFILE;
|
|
221
|
+
const useOverrides = strategy === deploy_strategy_enum_1.DeployStrategy.RAILPACK_WITH_OVERRIDES;
|
|
222
|
+
// ── Strategy-specific script sections ──────────────────────────────────
|
|
223
|
+
// RAILPACK_WITH_OVERRIDES: write railway.toml before railpack prepare
|
|
224
|
+
const railwayTomlInjection = (() => {
|
|
225
|
+
if (!useOverrides)
|
|
226
|
+
return '';
|
|
227
|
+
const buildCmd = config.suggestedBuildCommand;
|
|
228
|
+
const startCmd = config.suggestedStartCommand;
|
|
229
|
+
if (!buildCmd && !startCmd)
|
|
230
|
+
return '';
|
|
231
|
+
const lines = [
|
|
232
|
+
"cat > /workspace/railway.toml <<'TOML_EOF'",
|
|
233
|
+
'[build]',
|
|
234
|
+
];
|
|
235
|
+
if (buildCmd)
|
|
236
|
+
lines.push(`buildCommand = "${buildCmd}"`);
|
|
237
|
+
lines.push('[deploy]');
|
|
238
|
+
if (startCmd)
|
|
239
|
+
lines.push(`startCommand = "${startCmd}"`);
|
|
240
|
+
lines.push('TOML_EOF', 'echo "FLUI-RUNNER: railway.toml injected (strategy=railpack_with_overrides)"');
|
|
241
|
+
return '\n ' + lines.join('\n ') + '\n';
|
|
242
|
+
})();
|
|
243
|
+
// DOCKERFILE strategy: write dockerfile content to workspace
|
|
244
|
+
const dockerfileWriteStep = (() => {
|
|
245
|
+
if (!useDockerfile)
|
|
246
|
+
return '';
|
|
247
|
+
const content = config.dockerfileContent ?? '';
|
|
248
|
+
if (!content)
|
|
249
|
+
return '';
|
|
250
|
+
// Use printf to avoid heredoc quoting issues with arbitrary Dockerfile content
|
|
251
|
+
const escaped = content
|
|
252
|
+
.replaceAll('\\\\', '\\\\')
|
|
253
|
+
.replaceAll("'", "'\\''")
|
|
254
|
+
.replaceAll('n', '\\n');
|
|
255
|
+
return `\n printf '${escaped}' > /workspace/Dockerfile\n echo "FLUI-RUNNER: Dockerfile written from build advisor (strategy=dockerfile)"\n`;
|
|
256
|
+
})();
|
|
257
|
+
// Build frontend selection: dockerfile.v0 for DOCKERFILE, gateway.v0 (Railpack) otherwise
|
|
258
|
+
const buildFrontendArgs = useDockerfile
|
|
259
|
+
? `--frontend dockerfile.v0 \\
|
|
260
|
+
--local context=/workspace \\
|
|
261
|
+
--local dockerfile=/workspace`
|
|
262
|
+
: `--frontend gateway.v0 \\
|
|
263
|
+
--opt source=ghcr.io/railwayapp/railpack-frontend \\
|
|
264
|
+
--opt filename=railpack-plan.json \\
|
|
265
|
+
--local context=/workspace \\
|
|
266
|
+
--local dockerfile=/tmp`;
|
|
267
|
+
// Railpack plan step is only needed for non-DOCKERFILE strategies
|
|
268
|
+
const railpackPlanStep = useDockerfile
|
|
269
|
+
? ''
|
|
270
|
+
: [
|
|
271
|
+
'',
|
|
272
|
+
' echo "--- RAILPACK PLAN ---"',
|
|
273
|
+
' railpack prepare . --plan-out /tmp/railpack-plan.json',
|
|
274
|
+
' if [ -f /tmp/railpack-plan.json ]; then',
|
|
275
|
+
' tr -d \'\\n\\r\' < /tmp/railpack-plan.json && echo ""',
|
|
276
|
+
' fi',
|
|
277
|
+
'',
|
|
278
|
+
' # Fix railpack start command for single-project Gradle builds.',
|
|
279
|
+
" if grep -q '\\*/build/libs/' /tmp/railpack-plan.json 2>/dev/null; then",
|
|
280
|
+
' IS_MULTI_PROJECT=0',
|
|
281
|
+
" if grep -qE '^[[:space:]]*include[[:space:]]*\\(' /workspace/settings.gradle 2>/dev/null || \\",
|
|
282
|
+
" grep -qE '^[[:space:]]*include[[:space:]]*\\(' /workspace/settings.gradle.kts 2>/dev/null; then",
|
|
283
|
+
' IS_MULTI_PROJECT=1',
|
|
284
|
+
' fi',
|
|
285
|
+
' if [ "$IS_MULTI_PROJECT" -eq 0 ]; then',
|
|
286
|
+
' echo "FLUI-RUNNER: Single-project Gradle — fixing */build/libs/ in railpack plan"',
|
|
287
|
+
" sed -i 's|\\*/build/libs/|build/libs/|g' /tmp/railpack-plan.json",
|
|
288
|
+
' echo "FLUI-RUNNER: Plan patched"',
|
|
289
|
+
' else',
|
|
290
|
+
' echo "FLUI-RUNNER: Multi-project Gradle — keeping */build/libs/ glob as-is"',
|
|
291
|
+
' fi',
|
|
292
|
+
' fi',
|
|
293
|
+
].join('\n');
|
|
294
|
+
// For public repos, clone using the plain URL (no token). For private repos, inject token.
|
|
295
|
+
const gitCloneTarget = config.cloneUrl
|
|
296
|
+
? `"${config.cloneUrl}"`
|
|
297
|
+
: `"https://x-oauth-basic:$(GITHUB_TOKEN)@github.com/${repoOwner}/${repoName}.git"`;
|
|
298
|
+
const gitCloneEnv = config.cloneUrl
|
|
299
|
+
? ''
|
|
300
|
+
: `
|
|
301
|
+
env:
|
|
302
|
+
- name: GITHUB_TOKEN
|
|
303
|
+
valueFrom:
|
|
304
|
+
secretKeyRef:
|
|
305
|
+
name: ghcr-push-secret
|
|
306
|
+
key: github_token`;
|
|
307
|
+
const usePrivileged = this.configService.get('BUILDKIT_PRIVILEGED_MODE', 'true') ===
|
|
308
|
+
'true';
|
|
309
|
+
const buildkitSecurityContext = usePrivileged
|
|
310
|
+
? `
|
|
311
|
+
securityContext:
|
|
312
|
+
privileged: true`
|
|
313
|
+
: `
|
|
314
|
+
securityContext:
|
|
315
|
+
seccompProfile:
|
|
316
|
+
type: Unconfined
|
|
317
|
+
runAsUser: 1000
|
|
318
|
+
runAsGroup: 1000`;
|
|
319
|
+
const buildkitImage = usePrivileged
|
|
320
|
+
? 'moby/buildkit:v0.15.1'
|
|
321
|
+
: 'moby/buildkit:v0.15.1-rootless';
|
|
322
|
+
const manifest = `
|
|
323
|
+
apiVersion: batch/v1
|
|
324
|
+
kind: Job
|
|
325
|
+
metadata:
|
|
326
|
+
name: ${build.k8sJobName}
|
|
327
|
+
namespace: ${exports.BUILD_NAMESPACE}
|
|
328
|
+
labels:
|
|
329
|
+
app.kubernetes.io/managed-by: flui-cloud
|
|
330
|
+
flui.cloud/build-id: "${build.id}"
|
|
331
|
+
flui.cloud/app-id: "${app.id}"
|
|
332
|
+
flui.cloud/app-slug: "${app.slug}"
|
|
333
|
+
spec:
|
|
334
|
+
ttlSecondsAfterFinished: 3600
|
|
335
|
+
backoffLimit: 0
|
|
336
|
+
activeDeadlineSeconds: 1800
|
|
337
|
+
template:
|
|
338
|
+
metadata:
|
|
339
|
+
labels:
|
|
340
|
+
flui.cloud/build-id: "${build.id}"
|
|
341
|
+
flui.cloud/app-slug: "${app.slug}"
|
|
342
|
+
spec:
|
|
343
|
+
restartPolicy: Never
|
|
344
|
+
imagePullSecrets:
|
|
345
|
+
- name: ghcr-runner-pull-secret
|
|
346
|
+
initContainers:
|
|
347
|
+
- name: git-clone
|
|
348
|
+
image: alpine/git:2.43.0
|
|
349
|
+
command:
|
|
350
|
+
- sh
|
|
351
|
+
- -c
|
|
352
|
+
- |
|
|
353
|
+
git clone --depth=1 --branch "${branch}" \\
|
|
354
|
+
${gitCloneTarget} \\
|
|
355
|
+
/workspace && \\
|
|
356
|
+
cd /workspace && \\
|
|
357
|
+
git log -1 --format="%H" > /workspace/.commit-sha && \\
|
|
358
|
+
echo "Clone complete: $(cat /workspace/.commit-sha)"${gitCloneEnv}
|
|
359
|
+
volumeMounts:
|
|
360
|
+
- name: workspace
|
|
361
|
+
mountPath: /workspace
|
|
362
|
+
resources:
|
|
363
|
+
requests:
|
|
364
|
+
cpu: 100m
|
|
365
|
+
memory: 128Mi
|
|
366
|
+
limits:
|
|
367
|
+
cpu: 500m
|
|
368
|
+
memory: 256Mi
|
|
369
|
+
containers:
|
|
370
|
+
- name: build
|
|
371
|
+
image: ${exports.BUILD_RUNNER_IMAGE}
|
|
372
|
+
imagePullPolicy: IfNotPresent
|
|
373
|
+
command:
|
|
374
|
+
- sh
|
|
375
|
+
- -c
|
|
376
|
+
- |
|
|
377
|
+
set -e
|
|
378
|
+
|
|
379
|
+
echo "Railpack: $(railpack --version)"
|
|
380
|
+
echo "buildctl: $(buildctl --version)"
|
|
381
|
+
echo "FLUI-RUNNER: build script v2 (Foojay enabled)"
|
|
382
|
+
|
|
383
|
+
cd /workspace
|
|
384
|
+
|
|
385
|
+
# Output actual commit SHA cloned by init container (used for build deduplication)
|
|
386
|
+
ACTUAL_SHA=$(cat /workspace/.commit-sha 2>/dev/null | tr -d '[:space:]')
|
|
387
|
+
if [ -n "$ACTUAL_SHA" ]; then echo "COMMIT_SHA=$ACTUAL_SHA"; fi
|
|
388
|
+
|
|
389
|
+
# If the project declares a Gradle Java toolchain version, pin that version
|
|
390
|
+
# via .tool-versions so railpack/mise installs the exact JDK Gradle needs.
|
|
391
|
+
GRADLE_TOOLCHAIN_VERSION=$(grep -rE 'JavaLanguageVersion\\.of\\(' /workspace/build.gradle /workspace/build.gradle.kts 2>/dev/null | grep -oE 'of\\([0-9]+\\)' | grep -oE '[0-9]+' | sort -n | head -1)
|
|
392
|
+
if [ -n "$GRADLE_TOOLCHAIN_VERSION" ]; then
|
|
393
|
+
echo "FLUI-RUNNER: Gradle toolchain requires Java $GRADLE_TOOLCHAIN_VERSION — pinning via .tool-versions"
|
|
394
|
+
echo "java $GRADLE_TOOLCHAIN_VERSION" >> /workspace/.tool-versions
|
|
395
|
+
echo "FLUI-RUNNER: .tool-versions updated: $(cat /workspace/.tool-versions | grep java)"
|
|
396
|
+
else
|
|
397
|
+
echo "FLUI-RUNNER: No Gradle toolchain declaration found, using railpack default"
|
|
398
|
+
fi
|
|
399
|
+
|
|
400
|
+
${railwayTomlInjection}${dockerfileWriteStep}${railpackPlanStep}
|
|
401
|
+
|
|
402
|
+
echo "--- RAILPACK BUILD ---"
|
|
403
|
+
buildctl \\
|
|
404
|
+
--addr unix:///run/buildkit/buildkitd.sock \\
|
|
405
|
+
build${noCacheFlag} \\
|
|
406
|
+
${buildFrontendArgs} \\
|
|
407
|
+
--output "type=image,name=${imageRef},push=true"
|
|
408
|
+
|
|
409
|
+
echo "--- BUILD COMPLETE ---"
|
|
410
|
+
echo "IMAGE_REF=${imageRef}"
|
|
411
|
+
env:
|
|
412
|
+
- name: DOCKER_CONFIG
|
|
413
|
+
value: /root/.docker
|
|
414
|
+
volumeMounts:
|
|
415
|
+
- name: workspace
|
|
416
|
+
mountPath: /workspace
|
|
417
|
+
- name: buildkit-socket
|
|
418
|
+
mountPath: /run/buildkit
|
|
419
|
+
- name: docker-config
|
|
420
|
+
mountPath: /root/.docker
|
|
421
|
+
readOnly: true
|
|
422
|
+
resources:
|
|
423
|
+
requests:
|
|
424
|
+
cpu: 500m
|
|
425
|
+
memory: 512Mi
|
|
426
|
+
limits:
|
|
427
|
+
cpu: 2000m
|
|
428
|
+
memory: 2Gi
|
|
429
|
+
- name: buildkitd
|
|
430
|
+
image: ${buildkitImage}
|
|
431
|
+
args:
|
|
432
|
+
- --addr
|
|
433
|
+
- unix:///run/buildkit/buildkitd.sock
|
|
434
|
+
${buildkitSecurityContext}
|
|
435
|
+
volumeMounts:
|
|
436
|
+
- name: buildkit-socket
|
|
437
|
+
mountPath: /run/buildkit
|
|
438
|
+
- name: buildkit-cache
|
|
439
|
+
mountPath: /var/lib/buildkit
|
|
440
|
+
readinessProbe:
|
|
441
|
+
exec:
|
|
442
|
+
command:
|
|
443
|
+
- buildctl
|
|
444
|
+
- debug
|
|
445
|
+
- workers
|
|
446
|
+
initialDelaySeconds: 5
|
|
447
|
+
periodSeconds: 3
|
|
448
|
+
failureThreshold: 10
|
|
449
|
+
resources:
|
|
450
|
+
requests:
|
|
451
|
+
cpu: 200m
|
|
452
|
+
memory: 256Mi
|
|
453
|
+
limits:
|
|
454
|
+
cpu: 1000m
|
|
455
|
+
memory: 1Gi
|
|
456
|
+
volumes:
|
|
457
|
+
- name: workspace
|
|
458
|
+
emptyDir: {}
|
|
459
|
+
- name: buildkit-socket
|
|
460
|
+
emptyDir: {}
|
|
461
|
+
- name: docker-config
|
|
462
|
+
secret:
|
|
463
|
+
secretName: ghcr-push-secret
|
|
464
|
+
items:
|
|
465
|
+
- key: dockerconfig
|
|
466
|
+
path: config.json
|
|
467
|
+
- name: buildkit-cache
|
|
468
|
+
persistentVolumeClaim:
|
|
469
|
+
claimName: ${exports.BUILD_CACHE_PVC_NAME}
|
|
470
|
+
`;
|
|
471
|
+
// K8s Job spec.template is immutable — patching an existing job silently
|
|
472
|
+
// ignores command changes. Always delete the old job first so the new
|
|
473
|
+
// script takes effect.
|
|
474
|
+
await this.deleteJob(kubeconfig, build.k8sJobName);
|
|
475
|
+
await this.kubernetesService.applyManifest(kubeconfig, manifest);
|
|
476
|
+
this.logger.log(`Build Job ${build.k8sJobName} created in namespace ${exports.BUILD_NAMESPACE}`);
|
|
477
|
+
return build.k8sJobName;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Ensure the build runner image exists in ghcr.io.
|
|
481
|
+
* If missing, bootstrap it by running a K8s Job that builds and pushes the image
|
|
482
|
+
* using the same BuildKit infrastructure used for app builds.
|
|
483
|
+
*/
|
|
484
|
+
async ensureBuildRunnerImage(kubeconfig, githubUsername, githubToken) {
|
|
485
|
+
const exists = await this.checkBuildRunnerExists(githubUsername, githubToken);
|
|
486
|
+
if (exists) {
|
|
487
|
+
this.logger.debug(`Build runner image ${exports.BUILD_RUNNER_IMAGE} found — skipping bootstrap`);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
this.logger.log(`Build runner image ${exports.BUILD_RUNNER_IMAGE} not found — starting bootstrap build`);
|
|
491
|
+
await this.bootstrapBuildRunnerImage(kubeconfig);
|
|
492
|
+
this.logger.log(`Build runner image ${exports.BUILD_RUNNER_IMAGE} ready`);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Check if the build runner image exists in the ghcr.io registry.
|
|
496
|
+
* Uses the Docker Distribution API v2 with the user's GitHub token.
|
|
497
|
+
*/
|
|
498
|
+
async checkBuildRunnerExists(githubUsername, githubToken) {
|
|
499
|
+
const authBase64 = Buffer.from(`${githubUsername}:${githubToken}`).toString('base64');
|
|
500
|
+
try {
|
|
501
|
+
const tokenPayload = await this.httpsGetJson('https://ghcr.io/token?scope=repository:dawit-io/flui-build-runner:pull&service=ghcr.io', `Basic ${authBase64}`);
|
|
502
|
+
const registryToken = tokenPayload?.token ?? tokenPayload?.access_token;
|
|
503
|
+
if (!registryToken) {
|
|
504
|
+
this.logger.warn('Could not obtain ghcr.io registry token for build runner check');
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
const status = await this.httpsHeadStatus('https://ghcr.io/v2/dawit-io/flui-build-runner/manifests/railpack-0.22.2', `Bearer ${registryToken}`);
|
|
508
|
+
this.logger.debug(`Build runner manifest check: HTTP ${status}`);
|
|
509
|
+
return status === 200;
|
|
510
|
+
}
|
|
511
|
+
catch (err) {
|
|
512
|
+
this.logger.warn(`Build runner image check failed: ${err.message} — will bootstrap`);
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Build and push the build runner image by running a one-off K8s Job.
|
|
518
|
+
* The Job writes the Dockerfile from an embedded template, then uses
|
|
519
|
+
* BuildKit (already available in the cluster) to build and push it.
|
|
520
|
+
*/
|
|
521
|
+
async bootstrapBuildRunnerImage(kubeconfig) {
|
|
522
|
+
const jobName = `flui-bootstrap-runner-${Date.now().toString(36)}`;
|
|
523
|
+
const dockerfile = [
|
|
524
|
+
'FROM debian:12-slim',
|
|
525
|
+
'ARG RAILPACK_VERSION=0.22.2',
|
|
526
|
+
'ARG BUILDKIT_VERSION=0.15.1',
|
|
527
|
+
'RUN apt-get update -qq \\',
|
|
528
|
+
' && apt-get install -y -qq --no-install-recommends curl ca-certificates \\',
|
|
529
|
+
' && rm -rf /var/lib/apt/lists/*',
|
|
530
|
+
'RUN curl -fsSL "https://github.com/railwayapp/railpack/releases/download/v${RAILPACK_VERSION}/railpack-v${RAILPACK_VERSION}-x86_64-unknown-linux-musl.tar.gz" \\',
|
|
531
|
+
' | tar xz -C /usr/local/bin railpack \\',
|
|
532
|
+
' && chmod +x /usr/local/bin/railpack',
|
|
533
|
+
'RUN curl -fsSL "https://github.com/moby/buildkit/releases/download/v${BUILDKIT_VERSION}/buildkit-v${BUILDKIT_VERSION}.linux-amd64.tar.gz" \\',
|
|
534
|
+
' | tar xz -C /usr/local/bin --strip-components=1 bin/buildctl \\',
|
|
535
|
+
' && chmod +x /usr/local/bin/buildctl',
|
|
536
|
+
'RUN railpack --version && buildctl --version',
|
|
537
|
+
].join('\n');
|
|
538
|
+
const dockerfileBase64 = Buffer.from(dockerfile).toString('base64');
|
|
539
|
+
const usePrivileged = this.configService.get('BUILDKIT_PRIVILEGED_MODE', 'true') ===
|
|
540
|
+
'true';
|
|
541
|
+
const buildkitSecurityContext = usePrivileged
|
|
542
|
+
? `
|
|
543
|
+
securityContext:
|
|
544
|
+
privileged: true`
|
|
545
|
+
: `
|
|
546
|
+
securityContext:
|
|
547
|
+
seccompProfile:
|
|
548
|
+
type: Unconfined
|
|
549
|
+
runAsUser: 1000
|
|
550
|
+
runAsGroup: 1000`;
|
|
551
|
+
const manifest = `
|
|
552
|
+
apiVersion: batch/v1
|
|
553
|
+
kind: Job
|
|
554
|
+
metadata:
|
|
555
|
+
name: ${jobName}
|
|
556
|
+
namespace: ${exports.BUILD_NAMESPACE}
|
|
557
|
+
labels:
|
|
558
|
+
app.kubernetes.io/managed-by: flui-cloud
|
|
559
|
+
flui.cloud/purpose: bootstrap-runner
|
|
560
|
+
spec:
|
|
561
|
+
ttlSecondsAfterFinished: 300
|
|
562
|
+
backoffLimit: 0
|
|
563
|
+
activeDeadlineSeconds: 900
|
|
564
|
+
template:
|
|
565
|
+
spec:
|
|
566
|
+
restartPolicy: Never
|
|
567
|
+
imagePullSecrets:
|
|
568
|
+
- name: ghcr-runner-pull-secret
|
|
569
|
+
initContainers:
|
|
570
|
+
- name: write-dockerfile
|
|
571
|
+
image: alpine:3.19
|
|
572
|
+
command:
|
|
573
|
+
- sh
|
|
574
|
+
- -c
|
|
575
|
+
- |
|
|
576
|
+
echo '${dockerfileBase64}' | base64 -d > /workspace/Dockerfile
|
|
577
|
+
echo "Dockerfile written."
|
|
578
|
+
volumeMounts:
|
|
579
|
+
- name: workspace
|
|
580
|
+
mountPath: /workspace
|
|
581
|
+
resources:
|
|
582
|
+
requests:
|
|
583
|
+
cpu: 100m
|
|
584
|
+
memory: 64Mi
|
|
585
|
+
limits:
|
|
586
|
+
cpu: 200m
|
|
587
|
+
memory: 128Mi
|
|
588
|
+
containers:
|
|
589
|
+
- name: bootstrap
|
|
590
|
+
image: moby/buildkit:v0.15.1
|
|
591
|
+
command:
|
|
592
|
+
- sh
|
|
593
|
+
- -c
|
|
594
|
+
- |
|
|
595
|
+
echo "Waiting for buildkitd..."
|
|
596
|
+
until /usr/bin/buildctl --addr unix:///run/buildkit/buildkitd.sock debug workers > /dev/null 2>&1; do
|
|
597
|
+
sleep 2
|
|
598
|
+
done
|
|
599
|
+
echo "Building ${exports.BUILD_RUNNER_IMAGE}..."
|
|
600
|
+
/usr/bin/buildctl \\
|
|
601
|
+
--addr unix:///run/buildkit/buildkitd.sock \\
|
|
602
|
+
build \\
|
|
603
|
+
--frontend dockerfile.v0 \\
|
|
604
|
+
--local context=/workspace \\
|
|
605
|
+
--local dockerfile=/workspace \\
|
|
606
|
+
--output "type=image,name=${exports.BUILD_RUNNER_IMAGE},push=true"
|
|
607
|
+
echo "Bootstrap complete."
|
|
608
|
+
env:
|
|
609
|
+
- name: DOCKER_CONFIG
|
|
610
|
+
value: /root/.docker
|
|
611
|
+
volumeMounts:
|
|
612
|
+
- name: workspace
|
|
613
|
+
mountPath: /workspace
|
|
614
|
+
- name: buildkit-socket
|
|
615
|
+
mountPath: /run/buildkit
|
|
616
|
+
- name: docker-config
|
|
617
|
+
mountPath: /root/.docker
|
|
618
|
+
readOnly: true
|
|
619
|
+
resources:
|
|
620
|
+
requests:
|
|
621
|
+
cpu: 500m
|
|
622
|
+
memory: 512Mi
|
|
623
|
+
limits:
|
|
624
|
+
cpu: 2000m
|
|
625
|
+
memory: 2Gi
|
|
626
|
+
- name: buildkitd
|
|
627
|
+
image: moby/buildkit:v0.15.1
|
|
628
|
+
args:
|
|
629
|
+
- --addr
|
|
630
|
+
- unix:///run/buildkit/buildkitd.sock
|
|
631
|
+
${buildkitSecurityContext}
|
|
632
|
+
volumeMounts:
|
|
633
|
+
- name: buildkit-socket
|
|
634
|
+
mountPath: /run/buildkit
|
|
635
|
+
resources:
|
|
636
|
+
requests:
|
|
637
|
+
cpu: 200m
|
|
638
|
+
memory: 256Mi
|
|
639
|
+
limits:
|
|
640
|
+
cpu: 1000m
|
|
641
|
+
memory: 1Gi
|
|
642
|
+
volumes:
|
|
643
|
+
- name: workspace
|
|
644
|
+
emptyDir: {}
|
|
645
|
+
- name: buildkit-socket
|
|
646
|
+
emptyDir: {}
|
|
647
|
+
- name: docker-config
|
|
648
|
+
secret:
|
|
649
|
+
secretName: ghcr-push-secret
|
|
650
|
+
items:
|
|
651
|
+
- key: dockerconfig
|
|
652
|
+
path: config.json
|
|
653
|
+
`;
|
|
654
|
+
await this.kubernetesService.applyManifest(kubeconfig, manifest);
|
|
655
|
+
this.logger.log(`Bootstrap job ${jobName} created — building ${exports.BUILD_RUNNER_IMAGE}`);
|
|
656
|
+
await this.waitForJobCompletion(kubeconfig, jobName, 900_000);
|
|
657
|
+
try {
|
|
658
|
+
await this.kubernetesService.deleteResource(kubeconfig, 'Job', jobName, exports.BUILD_NAMESPACE);
|
|
659
|
+
}
|
|
660
|
+
catch {
|
|
661
|
+
/* non-fatal */
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
httpsGetJson(url, authorization) {
|
|
665
|
+
return new Promise((resolve, reject) => {
|
|
666
|
+
const req = https.get(url, { headers: { Authorization: authorization } }, (res) => {
|
|
667
|
+
let data = '';
|
|
668
|
+
res.on('data', (chunk) => {
|
|
669
|
+
data += chunk.toString();
|
|
670
|
+
});
|
|
671
|
+
res.on('end', () => {
|
|
672
|
+
try {
|
|
673
|
+
resolve(JSON.parse(data));
|
|
674
|
+
}
|
|
675
|
+
catch {
|
|
676
|
+
reject(new Error(`Non-JSON response from ${url}: ${data.substring(0, 100)}`));
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
req.on('error', reject);
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
httpsHeadStatus(url, authorization) {
|
|
684
|
+
const parsed = new URL(url);
|
|
685
|
+
return new Promise((resolve, reject) => {
|
|
686
|
+
const req = https.request({
|
|
687
|
+
hostname: parsed.hostname,
|
|
688
|
+
path: parsed.pathname + parsed.search,
|
|
689
|
+
method: 'HEAD',
|
|
690
|
+
headers: {
|
|
691
|
+
Authorization: authorization,
|
|
692
|
+
Accept: 'application/vnd.oci.image.manifest.v1+json,application/vnd.docker.distribution.manifest.v2+json',
|
|
693
|
+
},
|
|
694
|
+
}, (res) => resolve(res.statusCode ?? 0));
|
|
695
|
+
req.on('error', reject);
|
|
696
|
+
req.end();
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Delete a K3s Job and its pods (best-effort cleanup on failure).
|
|
701
|
+
*/
|
|
702
|
+
async deleteJob(kubeconfig, jobName, buildId) {
|
|
703
|
+
try {
|
|
704
|
+
await this.kubernetesService.deleteResource(kubeconfig, 'Job', jobName, exports.BUILD_NAMESPACE);
|
|
705
|
+
this.logger.log(`Build Job ${jobName} deleted from ${exports.BUILD_NAMESPACE}`);
|
|
706
|
+
}
|
|
707
|
+
catch (error) {
|
|
708
|
+
this.logger.warn(`Failed to delete build Job ${jobName}: ${error.message}`);
|
|
709
|
+
}
|
|
710
|
+
// Explicitly delete pods — cascade delete is not guaranteed without propagationPolicy
|
|
711
|
+
if (buildId) {
|
|
712
|
+
try {
|
|
713
|
+
const { coreApi } = this.kubernetesService.getKubeClient(kubeconfig);
|
|
714
|
+
await coreApi.deleteCollectionNamespacedPod({
|
|
715
|
+
namespace: exports.BUILD_NAMESPACE,
|
|
716
|
+
labelSelector: `flui.cloud/build-id=${buildId}`,
|
|
717
|
+
});
|
|
718
|
+
this.logger.log(`Deleted pods for build ${buildId} from ${exports.BUILD_NAMESPACE}`);
|
|
719
|
+
}
|
|
720
|
+
catch (error) {
|
|
721
|
+
this.logger.warn(`Failed to delete pods for build ${buildId}: ${error.message}`);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Poll until the build Job pod transitions to Running.
|
|
727
|
+
* Streams K8s Events for the pod to onStatusLine so the frontend receives
|
|
728
|
+
* live feedback (image pulls, container creation, etc.) during Pending.
|
|
729
|
+
* Returns the pod name once running.
|
|
730
|
+
*/
|
|
731
|
+
async waitForPodRunning(kubeconfig, buildId, timeoutMs = 600_000, onStatusLine) {
|
|
732
|
+
const { coreApi } = this.kubernetesService.getKubeClient(kubeconfig);
|
|
733
|
+
const deadline = Date.now() + timeoutMs;
|
|
734
|
+
const labelSelector = `flui.cloud/build-id=${buildId}`;
|
|
735
|
+
const seenEventUids = new Set();
|
|
736
|
+
let podName;
|
|
737
|
+
while (Date.now() < deadline) {
|
|
738
|
+
// ── 1. Find the pod (any phase) ────────────────────────────────────────
|
|
739
|
+
const pods = await coreApi.listNamespacedPod({
|
|
740
|
+
namespace: exports.BUILD_NAMESPACE,
|
|
741
|
+
labelSelector,
|
|
742
|
+
});
|
|
743
|
+
const pod = (pods.items ?? [])[0];
|
|
744
|
+
if (!pod) {
|
|
745
|
+
onStatusLine?.('Waiting for build pod to be scheduled...');
|
|
746
|
+
await this.sleep(3000);
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
podName = pod.metadata?.name;
|
|
750
|
+
// ── 2. Fail fast on unrecoverable container states ────────────────────
|
|
751
|
+
const allContainerStatuses = [
|
|
752
|
+
...(pod.status?.initContainerStatuses ?? []),
|
|
753
|
+
...(pod.status?.containerStatuses ?? []),
|
|
754
|
+
];
|
|
755
|
+
const FATAL_REASONS = [
|
|
756
|
+
'ImagePullBackOff',
|
|
757
|
+
'ErrImagePull',
|
|
758
|
+
'InvalidImageName',
|
|
759
|
+
'ImageInspectError',
|
|
760
|
+
];
|
|
761
|
+
for (const cs of allContainerStatuses) {
|
|
762
|
+
const waitingReason = cs.state?.waiting?.reason;
|
|
763
|
+
if (waitingReason && FATAL_REASONS.includes(waitingReason)) {
|
|
764
|
+
const msg = `Container "${cs.name}" failed to start: ${cs.state.waiting.message ?? waitingReason}`;
|
|
765
|
+
onStatusLine?.(msg);
|
|
766
|
+
throw new Error(msg);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
// Fail fast on unschedulable (after 30s grace period)
|
|
770
|
+
const unschedulable = pod.status?.conditions?.find((c) => c.type === 'PodScheduled' &&
|
|
771
|
+
c.status === 'False' &&
|
|
772
|
+
c.reason === 'Unschedulable');
|
|
773
|
+
if (unschedulable && Date.now() > deadline - timeoutMs + 30_000) {
|
|
774
|
+
const msg = `Pod unschedulable: ${unschedulable.message ?? 'insufficient resources'}`;
|
|
775
|
+
onStatusLine?.(msg);
|
|
776
|
+
throw new Error(msg);
|
|
777
|
+
}
|
|
778
|
+
// ── 3. Stream K8s Events for this pod (dedup by uid) ──────────────────
|
|
779
|
+
if (podName) {
|
|
780
|
+
try {
|
|
781
|
+
const events = await coreApi.listNamespacedEvent({
|
|
782
|
+
namespace: exports.BUILD_NAMESPACE,
|
|
783
|
+
fieldSelector: `involvedObject.name=${podName}`,
|
|
784
|
+
});
|
|
785
|
+
for (const ev of events.items ?? []) {
|
|
786
|
+
const uid = ev.metadata?.uid;
|
|
787
|
+
if (uid && !seenEventUids.has(uid) && ev.message) {
|
|
788
|
+
seenEventUids.add(uid);
|
|
789
|
+
onStatusLine?.(ev.message);
|
|
790
|
+
this.logger.debug(`[pod-event] ${ev.message}`);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
catch {
|
|
795
|
+
// RBAC or transient error — non-fatal, skip events this tick
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
// ── 4. Check phase ─────────────────────────────────────────────────────
|
|
799
|
+
const phase = pod.status?.phase;
|
|
800
|
+
if (phase === 'Failed') {
|
|
801
|
+
// Check initContainers first (e.g. git-clone failure), then regular containers
|
|
802
|
+
const failedInit = pod.status?.initContainerStatuses?.find((cs) => cs.state?.terminated?.exitCode !== 0);
|
|
803
|
+
const failedContainer = pod.status?.containerStatuses?.find((cs) => cs.state?.terminated?.exitCode !== 0);
|
|
804
|
+
const failed = failedInit ?? failedContainer;
|
|
805
|
+
const containerName = failed?.name ?? 'unknown';
|
|
806
|
+
const exitCode = failed?.state?.terminated?.exitCode;
|
|
807
|
+
// Read container logs before pod gets deleted — this is the actual error (e.g. git stderr)
|
|
808
|
+
let containerLogs = '';
|
|
809
|
+
if (podName) {
|
|
810
|
+
try {
|
|
811
|
+
const logsResp = await coreApi.readNamespacedPodLog({
|
|
812
|
+
name: podName,
|
|
813
|
+
namespace: exports.BUILD_NAMESPACE,
|
|
814
|
+
container: containerName,
|
|
815
|
+
tailLines: 20,
|
|
816
|
+
});
|
|
817
|
+
containerLogs =
|
|
818
|
+
typeof logsResp === 'string'
|
|
819
|
+
? logsResp.trim()
|
|
820
|
+
: (logsResp?.body?.trim() ?? '');
|
|
821
|
+
}
|
|
822
|
+
catch {
|
|
823
|
+
// non-fatal — pod may already be terminating
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
const fallbackMessage = failed?.state?.terminated?.message ??
|
|
827
|
+
failed?.state?.terminated?.reason ??
|
|
828
|
+
pod.status?.message ??
|
|
829
|
+
'Unknown reason';
|
|
830
|
+
const errorDetail = containerLogs || fallbackMessage;
|
|
831
|
+
throw new Error(`Build pod failed: container "${containerName}" exited with code ${exitCode ?? '?'}: ${errorDetail}`);
|
|
832
|
+
}
|
|
833
|
+
if (phase === 'Running' || phase === 'Succeeded') {
|
|
834
|
+
this.logger.log(`Build pod ${podName} is ${phase}`);
|
|
835
|
+
return podName;
|
|
836
|
+
}
|
|
837
|
+
await this.sleep(3000);
|
|
838
|
+
}
|
|
839
|
+
throw new Error(`Timeout waiting for build pod to start (${timeoutMs}ms)`);
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Poll the Job status until it succeeds or fails.
|
|
843
|
+
* Returns true on success, throws on failure.
|
|
844
|
+
*/
|
|
845
|
+
async waitForJobCompletion(kubeconfig, jobName, timeoutMs = 1800000) {
|
|
846
|
+
const { batchApi } = this.kubernetesService.getKubeClient(kubeconfig);
|
|
847
|
+
const deadline = Date.now() + timeoutMs;
|
|
848
|
+
while (Date.now() < deadline) {
|
|
849
|
+
const job = await batchApi.readNamespacedJob({
|
|
850
|
+
name: jobName,
|
|
851
|
+
namespace: exports.BUILD_NAMESPACE,
|
|
852
|
+
});
|
|
853
|
+
const status = job.status;
|
|
854
|
+
if (status?.succeeded > 0) {
|
|
855
|
+
this.logger.log(`Build Job ${jobName} completed successfully`);
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
if (status?.failed > 0) {
|
|
859
|
+
throw new Error(`Build Job ${jobName} failed (attempts: ${status.failed})`);
|
|
860
|
+
}
|
|
861
|
+
await this.sleep(5000);
|
|
862
|
+
}
|
|
863
|
+
throw new Error(`Timeout waiting for build Job ${jobName} to complete (${timeoutMs}ms)`);
|
|
864
|
+
}
|
|
865
|
+
// ─── Namespace resource inspection & cleanup ────────────────────────────────
|
|
866
|
+
/**
|
|
867
|
+
* List all Jobs and Pods in the flui-build namespace with status, age, and labels.
|
|
868
|
+
*
|
|
869
|
+
* Tolerates a missing namespace (returns empty lists) so that callers can
|
|
870
|
+
* safely query diagnostic endpoints on clusters where the in-cluster build
|
|
871
|
+
* agent has never run — e.g. when the master switch is disabled.
|
|
872
|
+
*/
|
|
873
|
+
async getNamespaceResources(kubeconfig) {
|
|
874
|
+
const { coreApi, batchApi } = this.kubernetesService.getKubeClient(kubeconfig);
|
|
875
|
+
try {
|
|
876
|
+
const [jobsRes, podsRes] = await Promise.all([
|
|
877
|
+
batchApi.listNamespacedJob({ namespace: exports.BUILD_NAMESPACE }),
|
|
878
|
+
coreApi.listNamespacedPod({ namespace: exports.BUILD_NAMESPACE }),
|
|
879
|
+
]);
|
|
880
|
+
const jobs = (jobsRes.items ?? []).map((job) => {
|
|
881
|
+
const containers = job.spec?.template?.spec?.containers ?? [];
|
|
882
|
+
return {
|
|
883
|
+
name: job.metadata?.name ?? '',
|
|
884
|
+
status: this.deriveJobStatus(job),
|
|
885
|
+
ageSecs: this.ageSeconds(job.metadata?.creationTimestamp),
|
|
886
|
+
buildId: job.metadata?.labels?.['flui.cloud/build-id'] ?? null,
|
|
887
|
+
appSlug: job.metadata?.labels?.['flui.cloud/app-slug'] ?? null,
|
|
888
|
+
purpose: job.metadata?.labels?.['flui.cloud/purpose'] ?? null,
|
|
889
|
+
cpuRequestMillicores: containers.reduce((sum, c) => sum + this.parseCpuMillicores(c.resources?.requests?.['cpu']), 0),
|
|
890
|
+
memoryRequestMiB: containers.reduce((sum, c) => sum + this.parseMemoryMiB(c.resources?.requests?.['memory']), 0),
|
|
891
|
+
};
|
|
892
|
+
});
|
|
893
|
+
const pods = (podsRes.items ?? []).map((pod) => ({
|
|
894
|
+
name: pod.metadata?.name ?? '',
|
|
895
|
+
phase: pod.status?.phase ?? 'Unknown',
|
|
896
|
+
ageSecs: this.ageSeconds(pod.metadata?.creationTimestamp),
|
|
897
|
+
buildId: pod.metadata?.labels?.['flui.cloud/build-id'] ?? null,
|
|
898
|
+
appSlug: pod.metadata?.labels?.['flui.cloud/app-slug'] ?? null,
|
|
899
|
+
containers: [
|
|
900
|
+
...(pod.status?.initContainerStatuses ?? []),
|
|
901
|
+
...(pod.status?.containerStatuses ?? []),
|
|
902
|
+
].map((cs) => ({
|
|
903
|
+
name: cs.name,
|
|
904
|
+
ready: cs.ready ?? false,
|
|
905
|
+
state: this.deriveContainerState(cs),
|
|
906
|
+
})),
|
|
907
|
+
}));
|
|
908
|
+
return { jobs, pods };
|
|
909
|
+
}
|
|
910
|
+
catch (err) {
|
|
911
|
+
if (this.isNamespaceNotFoundError(err)) {
|
|
912
|
+
return { jobs: [], pods: [] };
|
|
913
|
+
}
|
|
914
|
+
throw err;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Returns true if the error came from the Kubernetes API indicating that
|
|
919
|
+
* the target namespace (or a resource within it) does not exist.
|
|
920
|
+
* Handles both the new `@kubernetes/client-node` v1 error shape
|
|
921
|
+
* (`ApiException` with `.code`) and the legacy `.response.statusCode` shape.
|
|
922
|
+
*/
|
|
923
|
+
isNamespaceNotFoundError(err) {
|
|
924
|
+
if (!err)
|
|
925
|
+
return false;
|
|
926
|
+
const code = err.code ?? err.statusCode ?? err.response?.statusCode;
|
|
927
|
+
if (code === 404)
|
|
928
|
+
return true;
|
|
929
|
+
const reason = err.body?.reason ??
|
|
930
|
+
err.response?.body?.reason ??
|
|
931
|
+
(typeof err.body === 'string' ? undefined : err.body?.reason);
|
|
932
|
+
return reason === 'NotFound';
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Delete stale Jobs and orphaned Pods from the flui-build namespace.
|
|
936
|
+
* Stale = build is in a terminal DB state, or the resource is in a K8s terminal state.
|
|
937
|
+
* @param activeBuilds Set of build IDs that are currently in-progress (should NOT be deleted).
|
|
938
|
+
* @param olderThanMinutes If > 0, skip resources younger than this threshold.
|
|
939
|
+
* @param dryRun If true, return what would be deleted without making changes.
|
|
940
|
+
*/
|
|
941
|
+
async cleanupStaleResources(kubeconfig, activeBuilds, olderThanMinutes, dryRun) {
|
|
942
|
+
const { coreApi } = this.kubernetesService.getKubeClient(kubeconfig);
|
|
943
|
+
const { jobs, pods } = await this.getNamespaceResources(kubeconfig);
|
|
944
|
+
const minAgeSecs = olderThanMinutes * 60;
|
|
945
|
+
const deletedJobs = [];
|
|
946
|
+
const deletedPods = [];
|
|
947
|
+
for (const job of jobs) {
|
|
948
|
+
if (!this.isJobStale(job, activeBuilds, minAgeSecs))
|
|
949
|
+
continue;
|
|
950
|
+
deletedJobs.push(job.name);
|
|
951
|
+
if (!dryRun) {
|
|
952
|
+
await this.kubernetesService
|
|
953
|
+
.deleteResource(kubeconfig, 'Job', job.name, exports.BUILD_NAMESPACE)
|
|
954
|
+
.catch((e) => this.logger.warn(`Cleanup: failed to delete Job ${job.name}: ${e.message}`));
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
for (const pod of pods) {
|
|
958
|
+
if (!this.isPodStale(pod, activeBuilds, minAgeSecs))
|
|
959
|
+
continue;
|
|
960
|
+
deletedPods.push(pod.name);
|
|
961
|
+
if (!dryRun) {
|
|
962
|
+
await coreApi
|
|
963
|
+
.deleteNamespacedPod({ name: pod.name, namespace: exports.BUILD_NAMESPACE })
|
|
964
|
+
.catch((e) => this.logger.warn(`Cleanup: failed to delete Pod ${pod.name}: ${e.message}`));
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
this.logger.log(`Namespace cleanup${dryRun ? ' (dry-run)' : ''}: ` +
|
|
968
|
+
`${deletedJobs.length} jobs, ${deletedPods.length} pods`);
|
|
969
|
+
return { deletedJobs, deletedPods };
|
|
970
|
+
}
|
|
971
|
+
isJobStale(job, activeBuilds, minAgeSecs) {
|
|
972
|
+
if (minAgeSecs > 0 && job.ageSecs < minAgeSecs)
|
|
973
|
+
return false;
|
|
974
|
+
// Bootstrap jobs: stale when not Running
|
|
975
|
+
if (job.purpose === 'bootstrap-runner') {
|
|
976
|
+
return job.status !== 'Running' && job.status !== 'Pending';
|
|
977
|
+
}
|
|
978
|
+
// App build jobs: stale when build is not in active state
|
|
979
|
+
if (job.buildId) {
|
|
980
|
+
return !activeBuilds.has(job.buildId);
|
|
981
|
+
}
|
|
982
|
+
// Any other terminal job
|
|
983
|
+
return job.status === 'Succeeded' || job.status === 'Failed';
|
|
984
|
+
}
|
|
985
|
+
isPodStale(pod, activeBuilds, minAgeSecs) {
|
|
986
|
+
const errorPhases = ['Failed', 'Unknown'];
|
|
987
|
+
const errorContainerStates = [
|
|
988
|
+
'OOMKilled',
|
|
989
|
+
'Error',
|
|
990
|
+
'CrashLoopBackOff',
|
|
991
|
+
'ImagePullBackOff',
|
|
992
|
+
];
|
|
993
|
+
// Always stale regardless of age if in an error state
|
|
994
|
+
const hasErrorContainer = pod.containers.some((c) => errorContainerStates.includes(c.state));
|
|
995
|
+
if (errorPhases.includes(pod.phase) || hasErrorContainer)
|
|
996
|
+
return true;
|
|
997
|
+
if (minAgeSecs > 0 && pod.ageSecs < minAgeSecs)
|
|
998
|
+
return false;
|
|
999
|
+
if (pod.buildId)
|
|
1000
|
+
return !activeBuilds.has(pod.buildId);
|
|
1001
|
+
return pod.phase === 'Succeeded';
|
|
1002
|
+
}
|
|
1003
|
+
deriveJobStatus(job) {
|
|
1004
|
+
if ((job.status?.active ?? 0) > 0)
|
|
1005
|
+
return 'Running';
|
|
1006
|
+
if ((job.status?.succeeded ?? 0) > 0)
|
|
1007
|
+
return 'Succeeded';
|
|
1008
|
+
if ((job.status?.failed ?? 0) > 0)
|
|
1009
|
+
return 'Failed';
|
|
1010
|
+
if (job.status?.startTime)
|
|
1011
|
+
return 'Pending';
|
|
1012
|
+
return 'Unknown';
|
|
1013
|
+
}
|
|
1014
|
+
deriveContainerState(cs) {
|
|
1015
|
+
if (cs.state?.running)
|
|
1016
|
+
return 'Running';
|
|
1017
|
+
if (cs.state?.terminated)
|
|
1018
|
+
return cs.state.terminated.reason ?? 'Terminated';
|
|
1019
|
+
if (cs.state?.waiting)
|
|
1020
|
+
return cs.state.waiting.reason ?? 'Waiting';
|
|
1021
|
+
return 'Unknown';
|
|
1022
|
+
}
|
|
1023
|
+
ageSeconds(creationTimestamp) {
|
|
1024
|
+
if (!creationTimestamp)
|
|
1025
|
+
return 0;
|
|
1026
|
+
return Math.floor((Date.now() - new Date(creationTimestamp).getTime()) / 1000);
|
|
1027
|
+
}
|
|
1028
|
+
parseCpuMillicores(cpu) {
|
|
1029
|
+
if (!cpu)
|
|
1030
|
+
return 0;
|
|
1031
|
+
if (cpu.endsWith('m'))
|
|
1032
|
+
return Number.parseInt(cpu.slice(0, -1), 10);
|
|
1033
|
+
return Math.round(Number.parseFloat(cpu) * 1000);
|
|
1034
|
+
}
|
|
1035
|
+
parseMemoryMiB(memory) {
|
|
1036
|
+
if (!memory)
|
|
1037
|
+
return 0;
|
|
1038
|
+
if (memory.endsWith('Mi'))
|
|
1039
|
+
return Number.parseInt(memory.slice(0, -2), 10);
|
|
1040
|
+
if (memory.endsWith('Gi'))
|
|
1041
|
+
return Math.round(Number.parseFloat(memory.slice(0, -2)) * 1024);
|
|
1042
|
+
if (memory.endsWith('Ki'))
|
|
1043
|
+
return Math.round(Number.parseInt(memory.slice(0, -2), 10) / 1024);
|
|
1044
|
+
if (memory.endsWith('M'))
|
|
1045
|
+
return Number.parseInt(memory.slice(0, -1), 10);
|
|
1046
|
+
return Math.round(Number.parseInt(memory, 10) / (1024 * 1024));
|
|
1047
|
+
}
|
|
1048
|
+
sleep(ms) {
|
|
1049
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
exports.BuildJobService = BuildJobService;
|
|
1053
|
+
exports.BuildJobService = BuildJobService = BuildJobService_1 = __decorate([
|
|
1054
|
+
(0, common_1.Injectable)(),
|
|
1055
|
+
__metadata("design:paramtypes", [kubernetes_service_1.KubernetesService,
|
|
1056
|
+
config_1.ConfigService])
|
|
1057
|
+
], BuildJobService);
|