@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,1164 @@
|
|
|
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 KubernetesService_1;
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.KubernetesService = void 0;
|
|
44
|
+
const common_1 = require("@nestjs/common");
|
|
45
|
+
const k8s = __importStar(require("@kubernetes/client-node"));
|
|
46
|
+
let KubernetesService = KubernetesService_1 = class KubernetesService {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.logger = new common_1.Logger(KubernetesService_1.name);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Public wrapper to expose a patched KubeConfig instance.
|
|
52
|
+
* Use this when you need to instantiate k8s client classes directly
|
|
53
|
+
* (e.g. k8s.Log for log streaming) rather than through getKubeClient().
|
|
54
|
+
*/
|
|
55
|
+
makeKubeConfig(kubeconfigContent) {
|
|
56
|
+
return this.loadKubeconfig(kubeconfigContent);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Patch the kubeconfig server URL using KUBECONFIG_SERVER_OVERRIDE env var,
|
|
60
|
+
* then load it into a KubeConfig instance.
|
|
61
|
+
* All public methods that accept a kubeconfig string go through this helper
|
|
62
|
+
* so the patch is applied exactly once regardless of which service calls us.
|
|
63
|
+
*/
|
|
64
|
+
loadKubeconfig(kubeconfigContent) {
|
|
65
|
+
const kc = new k8s.KubeConfig();
|
|
66
|
+
kc.loadFromString(this.patchKubeconfigServer(kubeconfigContent));
|
|
67
|
+
return kc;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get Kubernetes client from kubeconfig string
|
|
71
|
+
*/
|
|
72
|
+
getKubeClient(kubeconfigContent) {
|
|
73
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
74
|
+
return {
|
|
75
|
+
coreApi: kc.makeApiClient(k8s.CoreV1Api),
|
|
76
|
+
appsApi: kc.makeApiClient(k8s.AppsV1Api),
|
|
77
|
+
batchApi: kc.makeApiClient(k8s.BatchV1Api),
|
|
78
|
+
networkingApi: kc.makeApiClient(k8s.NetworkingV1Api),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Canonicalize a parsed spec into the exact JSON string that will be stored
|
|
83
|
+
* on K8s under `metadata.annotations["kubectl.kubernetes.io/last-applied-configuration"]`.
|
|
84
|
+
*
|
|
85
|
+
* MUTATES `spec`: ensures `metadata.annotations` exists (possibly as {}) and
|
|
86
|
+
* strips any pre-existing last-applied-configuration key before serializing.
|
|
87
|
+
* The returned string is the canonical form that drift detection will hash —
|
|
88
|
+
* both sides (apply-time and reconcile-time) must produce identical bytes.
|
|
89
|
+
*
|
|
90
|
+
* Keep this the single source of truth — do not inline this logic elsewhere.
|
|
91
|
+
*/
|
|
92
|
+
buildLastAppliedConfiguration(spec) {
|
|
93
|
+
spec.metadata = spec.metadata || {};
|
|
94
|
+
spec.metadata.annotations = spec.metadata.annotations || {};
|
|
95
|
+
delete spec.metadata.annotations['kubectl.kubernetes.io/last-applied-configuration'];
|
|
96
|
+
return JSON.stringify(spec);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Apply manifest from YAML string
|
|
100
|
+
* Supports multiple documents separated by ---
|
|
101
|
+
*/
|
|
102
|
+
async applyManifest(kubeconfigContent, manifestYaml) {
|
|
103
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
104
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
105
|
+
const specs = k8s.loadAllYaml(manifestYaml);
|
|
106
|
+
const results = [];
|
|
107
|
+
for (const spec of specs) {
|
|
108
|
+
// Skip empty documents
|
|
109
|
+
if (!spec || Object.keys(spec).length === 0) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
// Stamp the canonical last-applied-configuration annotation. The string
|
|
113
|
+
// written here must byte-match what the deploy processor hashes as
|
|
114
|
+
// desiredHash — centralized via buildLastAppliedConfiguration().
|
|
115
|
+
const lastApplied = this.buildLastAppliedConfiguration(spec);
|
|
116
|
+
spec.metadata.annotations['kubectl.kubernetes.io/last-applied-configuration'] = lastApplied;
|
|
117
|
+
try {
|
|
118
|
+
// Try to create the resource
|
|
119
|
+
const createResponse = await client.create(spec);
|
|
120
|
+
this.logger.log(`Created ${spec.kind}/${spec.metadata?.name} in namespace ${spec.metadata?.namespace || 'default'}`);
|
|
121
|
+
results.push(createResponse.body);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
// If resource already exists, patch it
|
|
125
|
+
// Use MergePatch because CRDs (e.g. cert-manager ClusterIssuer) do not
|
|
126
|
+
// support the default StrategicMergePatch content type.
|
|
127
|
+
if (this.httpCode(error) === 409) {
|
|
128
|
+
const patchResponse = await client.patch(spec, undefined, undefined, undefined, undefined, k8s.PatchStrategy.MergePatch);
|
|
129
|
+
this.logger.log(`Patched ${spec.kind}/${spec.metadata?.name} in namespace ${spec.metadata?.namespace || 'default'}`);
|
|
130
|
+
results.push(patchResponse.body);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.logger.error(`Failed to apply ${spec.kind}/${spec.metadata?.name}: ${error.message}`);
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return results;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Replace a manifest using HTTP PUT (full replace — removes keys not in payload).
|
|
142
|
+
* Creates the resource if it doesn't exist yet.
|
|
143
|
+
*/
|
|
144
|
+
async replaceManifest(kubeconfigContent, manifestYaml) {
|
|
145
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
146
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
147
|
+
const specs = k8s.loadAllYaml(manifestYaml);
|
|
148
|
+
const results = [];
|
|
149
|
+
for (const spec of specs) {
|
|
150
|
+
if (!spec || Object.keys(spec).length === 0)
|
|
151
|
+
continue;
|
|
152
|
+
spec.metadata = spec.metadata || {};
|
|
153
|
+
try {
|
|
154
|
+
// Fetch existing resource to get the resourceVersion (required for replace)
|
|
155
|
+
const existingRaw = await client.read(spec);
|
|
156
|
+
const existingObj = existingRaw.body ?? existingRaw;
|
|
157
|
+
spec.metadata.resourceVersion = existingObj?.metadata?.resourceVersion;
|
|
158
|
+
const replaceRaw = await client.replace(spec);
|
|
159
|
+
const replaceObj = replaceRaw.body ?? replaceRaw;
|
|
160
|
+
this.logger.log(`Replaced ${spec.kind}/${spec.metadata?.name} in namespace ${spec.metadata?.namespace || 'default'}`);
|
|
161
|
+
results.push(replaceObj);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (this.httpCode(error) === 404) {
|
|
165
|
+
// Resource doesn't exist yet — create it
|
|
166
|
+
const createResponse = await client.create(spec);
|
|
167
|
+
this.logger.log(`Created ${spec.kind}/${spec.metadata?.name} in namespace ${spec.metadata?.namespace || 'default'}`);
|
|
168
|
+
results.push(createResponse.body);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.logger.error(`Failed to replace ${spec.kind}/${spec.metadata?.name}: ${error.message}`);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return results;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Delete a Kubernetes resource
|
|
180
|
+
*/
|
|
181
|
+
async deleteResource(kubeconfigContent, kind, name, namespace = 'default') {
|
|
182
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
183
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
184
|
+
try {
|
|
185
|
+
await client.delete({
|
|
186
|
+
apiVersion: this.getApiVersionForKind(kind),
|
|
187
|
+
kind,
|
|
188
|
+
metadata: { name, namespace },
|
|
189
|
+
});
|
|
190
|
+
this.logger.log(`Deleted ${kind}/${name} in namespace ${namespace}`);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
if (this.httpCode(error) === 404) {
|
|
194
|
+
this.logger.warn(`${kind}/${name} not found, skipping deletion`);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
this.logger.error(`Failed to delete ${kind}/${name}: ${error.message}`);
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get a Kubernetes resource
|
|
204
|
+
*/
|
|
205
|
+
async getResource(kubeconfigContent, kind, name, namespace = 'default') {
|
|
206
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
207
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
208
|
+
try {
|
|
209
|
+
const response = await client.read({
|
|
210
|
+
apiVersion: this.getApiVersionForKind(kind),
|
|
211
|
+
kind,
|
|
212
|
+
metadata: { name, namespace },
|
|
213
|
+
});
|
|
214
|
+
return response;
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
if (this.httpCode(error) === 404) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
this.logger.error(`Failed to get ${kind}/${name}: ${error.message}`);
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Wait for a resource to be ready
|
|
226
|
+
*/
|
|
227
|
+
async waitForReady(kubeconfigContent, kind, name, namespace = 'default', timeoutMs = 300000) {
|
|
228
|
+
const startTime = Date.now();
|
|
229
|
+
const pollInterval = 5000; // 5 seconds
|
|
230
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
231
|
+
try {
|
|
232
|
+
const resource = await this.getResource(kubeconfigContent, kind, name, namespace);
|
|
233
|
+
if (!resource) {
|
|
234
|
+
this.logger.debug(`${kind}/${name} not found yet, waiting...`);
|
|
235
|
+
await this.sleep(pollInterval);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const isReady = this.checkResourceReady(kind, resource);
|
|
239
|
+
if (isReady) {
|
|
240
|
+
this.logger.log(`${kind}/${name} is ready`);
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
this.logger.debug(`${kind}/${name} not ready yet, waiting...`);
|
|
244
|
+
await this.sleep(pollInterval);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
this.logger.error(`Error checking ${kind}/${name} readiness: ${error.message}`);
|
|
248
|
+
await this.sleep(pollInterval);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
throw new Error(`Timeout waiting for ${kind}/${name} to be ready after ${timeoutMs}ms`);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get pod logs
|
|
255
|
+
*/
|
|
256
|
+
async getPodLogs(kubeconfigContent, podName, namespace = 'default', containerName, tailLines) {
|
|
257
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
258
|
+
try {
|
|
259
|
+
const response = await coreApi.readNamespacedPodLog({
|
|
260
|
+
name: podName,
|
|
261
|
+
namespace,
|
|
262
|
+
container: containerName,
|
|
263
|
+
tailLines,
|
|
264
|
+
});
|
|
265
|
+
return response;
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
this.logger.error(`Failed to get logs for ${podName}: ${error.message}`);
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* List resources by kind and namespace
|
|
274
|
+
*/
|
|
275
|
+
async listResources(kubeconfigContent, kind, namespace = 'default', labelSelector) {
|
|
276
|
+
const { coreApi, appsApi, batchApi } = this.getKubeClient(kubeconfigContent);
|
|
277
|
+
try {
|
|
278
|
+
let response;
|
|
279
|
+
switch (kind.toLowerCase()) {
|
|
280
|
+
case 'pod':
|
|
281
|
+
case 'pods':
|
|
282
|
+
response = await coreApi.listNamespacedPod({
|
|
283
|
+
namespace,
|
|
284
|
+
labelSelector,
|
|
285
|
+
});
|
|
286
|
+
break;
|
|
287
|
+
case 'service':
|
|
288
|
+
case 'services':
|
|
289
|
+
response = await coreApi.listNamespacedService({
|
|
290
|
+
namespace,
|
|
291
|
+
labelSelector,
|
|
292
|
+
});
|
|
293
|
+
break;
|
|
294
|
+
case 'deployment':
|
|
295
|
+
case 'deployments':
|
|
296
|
+
response = await appsApi.listNamespacedDeployment({
|
|
297
|
+
namespace,
|
|
298
|
+
labelSelector,
|
|
299
|
+
});
|
|
300
|
+
break;
|
|
301
|
+
case 'statefulset':
|
|
302
|
+
case 'statefulsets':
|
|
303
|
+
response = await appsApi.listNamespacedStatefulSet({
|
|
304
|
+
namespace,
|
|
305
|
+
labelSelector,
|
|
306
|
+
});
|
|
307
|
+
break;
|
|
308
|
+
case 'configmap':
|
|
309
|
+
case 'configmaps':
|
|
310
|
+
response = await coreApi.listNamespacedConfigMap({
|
|
311
|
+
namespace,
|
|
312
|
+
labelSelector,
|
|
313
|
+
});
|
|
314
|
+
break;
|
|
315
|
+
case 'secret':
|
|
316
|
+
case 'secrets':
|
|
317
|
+
response = await coreApi.listNamespacedSecret({
|
|
318
|
+
namespace,
|
|
319
|
+
labelSelector,
|
|
320
|
+
});
|
|
321
|
+
break;
|
|
322
|
+
case 'persistentvolumeclaim':
|
|
323
|
+
case 'persistentvolumeclaims':
|
|
324
|
+
response = await coreApi.listNamespacedPersistentVolumeClaim({
|
|
325
|
+
namespace,
|
|
326
|
+
labelSelector,
|
|
327
|
+
});
|
|
328
|
+
break;
|
|
329
|
+
case 'job':
|
|
330
|
+
case 'jobs':
|
|
331
|
+
response = await batchApi.listNamespacedJob({
|
|
332
|
+
namespace,
|
|
333
|
+
labelSelector,
|
|
334
|
+
});
|
|
335
|
+
break;
|
|
336
|
+
default:
|
|
337
|
+
throw new Error(`Unsupported resource kind: ${kind}`);
|
|
338
|
+
}
|
|
339
|
+
return response.items ?? response.body?.items ?? [];
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
this.logger.error(`Failed to list ${kind}: ${error.message}`);
|
|
343
|
+
throw error;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* List CRD resources (cert-manager Challenges, Orders, etc.) via KubernetesObjectApi.
|
|
348
|
+
*/
|
|
349
|
+
async listCrdResources(kubeconfigContent, kind, namespace) {
|
|
350
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
351
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
352
|
+
try {
|
|
353
|
+
const apiVersion = this.getApiVersionForKind(kind);
|
|
354
|
+
const response = await client.list(apiVersion, kind, namespace);
|
|
355
|
+
const body = response.body ?? response;
|
|
356
|
+
return body.items ?? [];
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
this.logger.error(`Failed to list CRD ${kind} in ${namespace ?? 'all namespaces'}: ${error.message}`);
|
|
360
|
+
return [];
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
async listResourcesByLabel(kubeconfigContent, kind, namespace, labelSelector) {
|
|
364
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
365
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
366
|
+
const apiVersion = this.getApiVersionForKind(kind);
|
|
367
|
+
try {
|
|
368
|
+
const response = await client.list(apiVersion, kind, namespace, undefined, undefined, undefined, undefined, labelSelector);
|
|
369
|
+
const body = response.body ?? response;
|
|
370
|
+
return body.items ?? [];
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
const code = this.httpCode(error);
|
|
374
|
+
if (code === 404)
|
|
375
|
+
return [];
|
|
376
|
+
this.logger.warn(`listResourcesByLabel ${kind} (${labelSelector}) in ${namespace} failed: ${error.message}`);
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Get resource details including container specs (requests/limits) and replica info.
|
|
382
|
+
* Returns structured data for Deployment, StatefulSet, DaemonSet.
|
|
383
|
+
*/
|
|
384
|
+
async getResourceDetail(kubeconfigContent, kind, name, namespace = 'default') {
|
|
385
|
+
const resource = await this.getResource(kubeconfigContent, kind, name, namespace);
|
|
386
|
+
if (!resource)
|
|
387
|
+
return null;
|
|
388
|
+
const detail = {
|
|
389
|
+
replicas: {},
|
|
390
|
+
containers: [],
|
|
391
|
+
};
|
|
392
|
+
switch (kind) {
|
|
393
|
+
case 'Deployment':
|
|
394
|
+
case 'StatefulSet': {
|
|
395
|
+
detail.replicas = {
|
|
396
|
+
desired: resource.spec?.replicas ?? 0,
|
|
397
|
+
ready: resource.status?.readyReplicas ?? 0,
|
|
398
|
+
available: resource.status?.availableReplicas ?? 0,
|
|
399
|
+
unavailable: resource.status?.unavailableReplicas ?? 0,
|
|
400
|
+
updated: resource.status?.updatedReplicas ?? 0,
|
|
401
|
+
};
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
case 'DaemonSet': {
|
|
405
|
+
detail.replicas = {
|
|
406
|
+
desired: resource.status?.desiredNumberScheduled ?? 0,
|
|
407
|
+
ready: resource.status?.numberReady ?? 0,
|
|
408
|
+
available: resource.status?.numberAvailable ?? 0,
|
|
409
|
+
unavailable: resource.status?.numberUnavailable ?? 0,
|
|
410
|
+
updated: resource.status?.updatedNumberScheduled ?? 0,
|
|
411
|
+
};
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const containers = resource.spec?.template?.spec?.containers ||
|
|
416
|
+
resource.spec?.containers ||
|
|
417
|
+
[];
|
|
418
|
+
for (const c of containers) {
|
|
419
|
+
detail.containers.push({
|
|
420
|
+
name: c.name,
|
|
421
|
+
image: c.image || '',
|
|
422
|
+
requests: {
|
|
423
|
+
cpu: c.resources?.requests?.cpu || null,
|
|
424
|
+
memory: c.resources?.requests?.memory || null,
|
|
425
|
+
},
|
|
426
|
+
limits: {
|
|
427
|
+
cpu: c.resources?.limits?.cpu || null,
|
|
428
|
+
memory: c.resources?.limits?.memory || null,
|
|
429
|
+
},
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
return detail;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Get pod-level CPU/memory usage from the Metrics API (metrics.k8s.io).
|
|
436
|
+
* Requires metrics-server to be installed on the cluster.
|
|
437
|
+
*/
|
|
438
|
+
async getPodMetrics(kubeconfigContent, namespace = 'default', labelSelector) {
|
|
439
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
440
|
+
const metricsClient = new k8s.Metrics(kc);
|
|
441
|
+
try {
|
|
442
|
+
const metricsResponse = await metricsClient.getPodMetrics(namespace);
|
|
443
|
+
let pods = metricsResponse.items || [];
|
|
444
|
+
if (labelSelector) {
|
|
445
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
446
|
+
const podList = await coreApi.listNamespacedPod({
|
|
447
|
+
namespace,
|
|
448
|
+
labelSelector,
|
|
449
|
+
});
|
|
450
|
+
const matchingNames = new Set(podList.items.map((p) => p.metadata?.name));
|
|
451
|
+
pods = pods.filter((p) => matchingNames.has(p.metadata?.name));
|
|
452
|
+
}
|
|
453
|
+
return pods.map((pod) => ({
|
|
454
|
+
name: pod.metadata?.name || '',
|
|
455
|
+
containers: (pod.containers || []).map((c) => ({
|
|
456
|
+
name: c.name,
|
|
457
|
+
usage: {
|
|
458
|
+
cpu: c.usage?.cpu || '0',
|
|
459
|
+
memory: c.usage?.memory || '0',
|
|
460
|
+
},
|
|
461
|
+
})),
|
|
462
|
+
}));
|
|
463
|
+
}
|
|
464
|
+
catch (error) {
|
|
465
|
+
if (this.httpCode(error) === 404 || error.message?.includes('metrics')) {
|
|
466
|
+
this.logger.warn('Metrics API not available (metrics-server may not be installed)');
|
|
467
|
+
return [];
|
|
468
|
+
}
|
|
469
|
+
this.logger.error(`Failed to get pod metrics: ${error.message}`);
|
|
470
|
+
return [];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Read a single pod as V1Pod. Returns null if not found.
|
|
475
|
+
*/
|
|
476
|
+
async readPod(kubeconfigContent, namespace, podName) {
|
|
477
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
478
|
+
try {
|
|
479
|
+
return await coreApi.readNamespacedPod({ name: podName, namespace });
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
if (this.httpCode(error) === 404)
|
|
483
|
+
return null;
|
|
484
|
+
throw error;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* List pods matching a label selector.
|
|
489
|
+
*/
|
|
490
|
+
async listPodsByLabel(kubeconfigContent, namespace, labelSelector) {
|
|
491
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
492
|
+
const response = await coreApi.listNamespacedPod({
|
|
493
|
+
namespace,
|
|
494
|
+
labelSelector,
|
|
495
|
+
});
|
|
496
|
+
return response.items ?? [];
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* List events that reference the given pod (involvedObject.name filter).
|
|
500
|
+
*/
|
|
501
|
+
async listPodEvents(kubeconfigContent, namespace, podName) {
|
|
502
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
503
|
+
const response = await coreApi.listNamespacedEvent({
|
|
504
|
+
namespace,
|
|
505
|
+
fieldSelector: `involvedObject.name=${podName}`,
|
|
506
|
+
});
|
|
507
|
+
return response.items ?? [];
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Check whether a Secret exists in the namespace.
|
|
511
|
+
*/
|
|
512
|
+
async checkSecretExists(kubeconfigContent, namespace, name) {
|
|
513
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
514
|
+
try {
|
|
515
|
+
await coreApi.readNamespacedSecret({ name, namespace });
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
catch (error) {
|
|
519
|
+
if (this.httpCode(error) === 404)
|
|
520
|
+
return false;
|
|
521
|
+
throw error;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Check whether a ConfigMap exists in the namespace.
|
|
526
|
+
*/
|
|
527
|
+
async checkConfigMapExists(kubeconfigContent, namespace, name) {
|
|
528
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
529
|
+
try {
|
|
530
|
+
await coreApi.readNamespacedConfigMap({ name, namespace });
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
catch (error) {
|
|
534
|
+
if (this.httpCode(error) === 404)
|
|
535
|
+
return false;
|
|
536
|
+
throw error;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Watch pod events in a namespace filtered by label selector. Uses the
|
|
541
|
+
* Kubernetes Watch API — events are delivered as they happen.
|
|
542
|
+
*
|
|
543
|
+
* Call `abortController.abort()` to stop the watch.
|
|
544
|
+
*/
|
|
545
|
+
async watchPodEvents(kubeconfigContent, namespace, labelSelector, onEvent, abortController) {
|
|
546
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
547
|
+
const watch = new k8s.Watch(kc);
|
|
548
|
+
const path = `/api/v1/namespaces/${namespace}/pods`;
|
|
549
|
+
const req = await watch.watch(path, { labelSelector }, (type, obj) => {
|
|
550
|
+
try {
|
|
551
|
+
const result = onEvent(type, obj);
|
|
552
|
+
if (result instanceof Promise) {
|
|
553
|
+
result.catch((err) => this.logger.error(`watchPodEvents onEvent error: ${err.message}`));
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
catch (err) {
|
|
557
|
+
this.logger.error(`watchPodEvents onEvent error: ${err.message}`);
|
|
558
|
+
}
|
|
559
|
+
}, (err) => {
|
|
560
|
+
if (err && !abortController.signal.aborted) {
|
|
561
|
+
this.logger.warn(`Pod watch closed with error in ${namespace}: ${err.message}`);
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
abortController.signal.addEventListener('abort', () => {
|
|
565
|
+
try {
|
|
566
|
+
req.abort();
|
|
567
|
+
}
|
|
568
|
+
catch {
|
|
569
|
+
/* noop */
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Discover which ConfigMaps and Secrets a workload uses via envFrom and env[].valueFrom.
|
|
575
|
+
* Returns deduplicated lists of names.
|
|
576
|
+
* Falls back to empty lists if the workload does not exist yet.
|
|
577
|
+
*/
|
|
578
|
+
async getWorkloadEnvSources(kubeconfigContent, name, namespace = 'default', kind = 'Deployment') {
|
|
579
|
+
const workload = await this.getResource(kubeconfigContent, kind, name, namespace);
|
|
580
|
+
if (!workload) {
|
|
581
|
+
return { configMaps: [], secrets: [] };
|
|
582
|
+
}
|
|
583
|
+
const containers = workload.spec?.template?.spec?.containers ?? [];
|
|
584
|
+
const configMapSet = new Set();
|
|
585
|
+
const secretSet = new Set();
|
|
586
|
+
for (const container of containers) {
|
|
587
|
+
for (const source of container.envFrom ?? []) {
|
|
588
|
+
if (source.configMapRef?.name)
|
|
589
|
+
configMapSet.add(source.configMapRef.name);
|
|
590
|
+
if (source.secretRef?.name)
|
|
591
|
+
secretSet.add(source.secretRef.name);
|
|
592
|
+
}
|
|
593
|
+
for (const envVar of container.env ?? []) {
|
|
594
|
+
if (envVar.valueFrom?.configMapKeyRef?.name)
|
|
595
|
+
configMapSet.add(envVar.valueFrom.configMapKeyRef.name);
|
|
596
|
+
if (envVar.valueFrom?.secretKeyRef?.name)
|
|
597
|
+
secretSet.add(envVar.valueFrom.secretKeyRef.name);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return {
|
|
601
|
+
configMaps: Array.from(configMapSet),
|
|
602
|
+
secrets: Array.from(secretSet),
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Execute a command in a pod and return stdout.
|
|
607
|
+
* Finds the first running pod matching the label selector.
|
|
608
|
+
*/
|
|
609
|
+
async execInPod(kubeconfigContent, namespace, labelSelector, containerName, command) {
|
|
610
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
611
|
+
const coreApi = kc.makeApiClient(k8s.CoreV1Api);
|
|
612
|
+
const pods = await coreApi.listNamespacedPod({ namespace, labelSelector });
|
|
613
|
+
const pod = (pods.items ?? []).find((p) => p.status?.phase === 'Running');
|
|
614
|
+
if (!pod?.metadata?.name) {
|
|
615
|
+
throw new Error(`No running pod found with selector "${labelSelector}" in namespace "${namespace}"`);
|
|
616
|
+
}
|
|
617
|
+
const exec = new k8s.Exec(kc);
|
|
618
|
+
return new Promise((resolve, reject) => {
|
|
619
|
+
let stdout = '';
|
|
620
|
+
let stderr = '';
|
|
621
|
+
exec
|
|
622
|
+
.exec(namespace, pod.metadata.name, containerName, command, {
|
|
623
|
+
write: (chunk) => {
|
|
624
|
+
stdout += typeof chunk === 'string' ? chunk : chunk.toString();
|
|
625
|
+
},
|
|
626
|
+
}, {
|
|
627
|
+
write: (chunk) => {
|
|
628
|
+
stderr += typeof chunk === 'string' ? chunk : chunk.toString();
|
|
629
|
+
},
|
|
630
|
+
}, null, false, (status) => {
|
|
631
|
+
if (status?.status === 'Success') {
|
|
632
|
+
resolve(stdout);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
reject(new Error(`exec failed: ${status?.message ?? stderr ?? 'unknown error'}`));
|
|
636
|
+
}
|
|
637
|
+
})
|
|
638
|
+
.catch(reject);
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Patch a Kubernetes Secret with new stringData entries.
|
|
643
|
+
*/
|
|
644
|
+
async patchSecret(kubeconfigContent, namespace, name, stringData) {
|
|
645
|
+
// Build a Secret manifest and use server-side apply (applyManifest) to avoid
|
|
646
|
+
// content-type issues with the generated k8s client (defaults to json-patch+json).
|
|
647
|
+
const entries = Object.entries(stringData)
|
|
648
|
+
.map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`)
|
|
649
|
+
.join('\n');
|
|
650
|
+
const manifest = [
|
|
651
|
+
'apiVersion: v1',
|
|
652
|
+
'kind: Secret',
|
|
653
|
+
'metadata:',
|
|
654
|
+
` name: ${name}`,
|
|
655
|
+
` namespace: ${namespace}`,
|
|
656
|
+
'stringData:',
|
|
657
|
+
entries,
|
|
658
|
+
].join('\n');
|
|
659
|
+
await this.applyManifest(kubeconfigContent, manifest);
|
|
660
|
+
this.logger.log(`Secret ${name} patched in namespace ${namespace}`);
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Trigger a rolling restart of a Deployment by patching the pod template annotation.
|
|
664
|
+
* Equivalent to `kubectl rollout restart deployment/<name>`.
|
|
665
|
+
*/
|
|
666
|
+
/**
|
|
667
|
+
* Trigger a rolling restart of a Deployment by patching the pod template annotation.
|
|
668
|
+
* Equivalent to `kubectl rollout restart deployment/<name>`.
|
|
669
|
+
*/
|
|
670
|
+
async restartDeployment(kubeconfigContent, namespace, name) {
|
|
671
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
672
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
673
|
+
const patch = {
|
|
674
|
+
apiVersion: 'apps/v1',
|
|
675
|
+
kind: 'Deployment',
|
|
676
|
+
metadata: { name, namespace },
|
|
677
|
+
spec: {
|
|
678
|
+
template: {
|
|
679
|
+
metadata: {
|
|
680
|
+
annotations: {
|
|
681
|
+
'kubectl.kubernetes.io/restartedAt': new Date().toISOString(),
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
},
|
|
685
|
+
},
|
|
686
|
+
};
|
|
687
|
+
await client.patch(patch, undefined, undefined, 'flui-api', undefined, k8s.PatchStrategy.StrategicMergePatch);
|
|
688
|
+
this.logger.log(`Deployment ${name} restart triggered in namespace ${namespace}`);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Equivalent to `kubectl set image deployment/<name> <container>=<image> -n <ns>`.
|
|
692
|
+
* Strategic merge patch only replaces the image of the named container,
|
|
693
|
+
* leaving init containers, sidecars and other spec fields untouched.
|
|
694
|
+
*/
|
|
695
|
+
async patchDeploymentContainerImage(kubeconfigContent, namespace, deploymentName, containerName, newImage) {
|
|
696
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
697
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
698
|
+
const patch = {
|
|
699
|
+
apiVersion: 'apps/v1',
|
|
700
|
+
kind: 'Deployment',
|
|
701
|
+
metadata: { name: deploymentName, namespace },
|
|
702
|
+
spec: {
|
|
703
|
+
template: {
|
|
704
|
+
spec: {
|
|
705
|
+
containers: [{ name: containerName, image: newImage }],
|
|
706
|
+
},
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
};
|
|
710
|
+
await client.patch(patch, undefined, undefined, 'flui-api', undefined, k8s.PatchStrategy.StrategicMergePatch);
|
|
711
|
+
this.logger.log(`Deployment ${deploymentName} container ${containerName} image set to ${newImage} in namespace ${namespace}`);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Read the current image of a container in a Deployment.
|
|
715
|
+
* Returns null if the deployment, container, or image is missing.
|
|
716
|
+
*/
|
|
717
|
+
async getDeploymentContainerImage(kubeconfigContent, namespace, deploymentName, containerName) {
|
|
718
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
719
|
+
const appsApi = kc.makeApiClient(k8s.AppsV1Api);
|
|
720
|
+
try {
|
|
721
|
+
const dep = await appsApi.readNamespacedDeployment({
|
|
722
|
+
name: deploymentName,
|
|
723
|
+
namespace,
|
|
724
|
+
});
|
|
725
|
+
const containers = dep.spec?.template?.spec?.containers ?? [];
|
|
726
|
+
const c = containers.find((x) => x.name === containerName);
|
|
727
|
+
return c?.image ?? null;
|
|
728
|
+
}
|
|
729
|
+
catch (err) {
|
|
730
|
+
if (this.httpCode(err) === 404)
|
|
731
|
+
return null;
|
|
732
|
+
throw err;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Read a file from a PVC by running a temporary busybox pod.
|
|
737
|
+
* The pod is deleted automatically after reading.
|
|
738
|
+
* Use this for distroless containers that don't have shell utilities.
|
|
739
|
+
*/
|
|
740
|
+
async readPvcFile(kubeconfigContent, namespace, pvcName, filePath) {
|
|
741
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
742
|
+
const coreApi = kc.makeApiClient(k8s.CoreV1Api);
|
|
743
|
+
const podName = `pvc-reader-${Date.now()}`;
|
|
744
|
+
const podManifest = {
|
|
745
|
+
apiVersion: 'v1',
|
|
746
|
+
kind: 'Pod',
|
|
747
|
+
metadata: { name: podName, namespace },
|
|
748
|
+
spec: {
|
|
749
|
+
restartPolicy: 'Never',
|
|
750
|
+
enableServiceLinks: false,
|
|
751
|
+
// Use rancher-mirrored busybox — already cached on every K3s node, no pull needed
|
|
752
|
+
volumes: [
|
|
753
|
+
{ name: 'pvc', persistentVolumeClaim: { claimName: pvcName } },
|
|
754
|
+
],
|
|
755
|
+
containers: [
|
|
756
|
+
{
|
|
757
|
+
name: 'reader',
|
|
758
|
+
image: 'rancher/mirrored-library-busybox:1.36.1',
|
|
759
|
+
command: ['cat', filePath],
|
|
760
|
+
volumeMounts: [{ name: 'pvc', mountPath: '/pvc' }],
|
|
761
|
+
},
|
|
762
|
+
],
|
|
763
|
+
},
|
|
764
|
+
};
|
|
765
|
+
try {
|
|
766
|
+
await coreApi.createNamespacedPod({ namespace, body: podManifest });
|
|
767
|
+
// Wait for pod to complete (max 60s)
|
|
768
|
+
const deadline = Date.now() + 60000;
|
|
769
|
+
while (Date.now() < deadline) {
|
|
770
|
+
const pod = await coreApi.readNamespacedPod({
|
|
771
|
+
name: podName,
|
|
772
|
+
namespace,
|
|
773
|
+
});
|
|
774
|
+
const phase = pod.status?.phase;
|
|
775
|
+
if (phase === 'Succeeded')
|
|
776
|
+
break;
|
|
777
|
+
if (phase === 'Failed')
|
|
778
|
+
throw new Error(`Reader pod failed`);
|
|
779
|
+
await this.sleep(2000);
|
|
780
|
+
}
|
|
781
|
+
// Read logs = stdout of cat command
|
|
782
|
+
const logs = await coreApi.readNamespacedPodLog({
|
|
783
|
+
name: podName,
|
|
784
|
+
namespace,
|
|
785
|
+
container: 'reader',
|
|
786
|
+
});
|
|
787
|
+
return typeof logs === 'string' ? logs : (logs.body ?? '');
|
|
788
|
+
}
|
|
789
|
+
finally {
|
|
790
|
+
await coreApi
|
|
791
|
+
.deleteNamespacedPod({ name: podName, namespace })
|
|
792
|
+
.catch(() => { });
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
/** @deprecated Use getWorkloadEnvSources with kind='Deployment' */
|
|
796
|
+
async getDeploymentEnvSources(kubeconfigContent, deploymentName, namespace = 'default') {
|
|
797
|
+
return this.getWorkloadEnvSources(kubeconfigContent, deploymentName, namespace, 'Deployment');
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Ensure a Kubernetes namespace exists, creating it if needed.
|
|
801
|
+
* Idempotent — safe to call before every deploy.
|
|
802
|
+
*/
|
|
803
|
+
async ensureNamespaceExists(kubeconfigContent, namespace, labels = {}) {
|
|
804
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
805
|
+
try {
|
|
806
|
+
await coreApi.readNamespace({ name: namespace });
|
|
807
|
+
this.logger.debug(`Namespace ${namespace} already exists`);
|
|
808
|
+
}
|
|
809
|
+
catch (error) {
|
|
810
|
+
if (this.httpCode(error) !== 404) {
|
|
811
|
+
throw error;
|
|
812
|
+
}
|
|
813
|
+
await coreApi.createNamespace({
|
|
814
|
+
body: {
|
|
815
|
+
apiVersion: 'v1',
|
|
816
|
+
kind: 'Namespace',
|
|
817
|
+
metadata: {
|
|
818
|
+
name: namespace,
|
|
819
|
+
labels: {
|
|
820
|
+
'managed-by': 'flui-cloud',
|
|
821
|
+
...labels,
|
|
822
|
+
},
|
|
823
|
+
},
|
|
824
|
+
},
|
|
825
|
+
});
|
|
826
|
+
this.logger.log(`Namespace ${namespace} created`);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
// Helper methods
|
|
830
|
+
getApiVersionForKind(kind) {
|
|
831
|
+
const apiVersionMap = {
|
|
832
|
+
Pod: 'v1',
|
|
833
|
+
Service: 'v1',
|
|
834
|
+
ConfigMap: 'v1',
|
|
835
|
+
Secret: 'v1',
|
|
836
|
+
PersistentVolumeClaim: 'v1',
|
|
837
|
+
Namespace: 'v1',
|
|
838
|
+
Deployment: 'apps/v1',
|
|
839
|
+
StatefulSet: 'apps/v1',
|
|
840
|
+
DaemonSet: 'apps/v1',
|
|
841
|
+
Job: 'batch/v1',
|
|
842
|
+
CronJob: 'batch/v1',
|
|
843
|
+
Ingress: 'networking.k8s.io/v1',
|
|
844
|
+
IngressRoute: 'traefik.containo.us/v1alpha1',
|
|
845
|
+
Certificate: 'cert-manager.io/v1',
|
|
846
|
+
CertificateRequest: 'cert-manager.io/v1',
|
|
847
|
+
ClusterIssuer: 'cert-manager.io/v1',
|
|
848
|
+
Issuer: 'cert-manager.io/v1',
|
|
849
|
+
Challenge: 'acme.cert-manager.io/v1',
|
|
850
|
+
Order: 'acme.cert-manager.io/v1',
|
|
851
|
+
ServiceAccount: 'v1',
|
|
852
|
+
ClusterRole: 'rbac.authorization.k8s.io/v1',
|
|
853
|
+
ClusterRoleBinding: 'rbac.authorization.k8s.io/v1',
|
|
854
|
+
MutatingWebhookConfiguration: 'admissionregistration.k8s.io/v1',
|
|
855
|
+
ValidatingWebhookConfiguration: 'admissionregistration.k8s.io/v1',
|
|
856
|
+
Role: 'rbac.authorization.k8s.io/v1',
|
|
857
|
+
RoleBinding: 'rbac.authorization.k8s.io/v1',
|
|
858
|
+
APIService: 'apiregistration.k8s.io/v1',
|
|
859
|
+
Backup: 'velero.io/v1',
|
|
860
|
+
Restore: 'velero.io/v1',
|
|
861
|
+
BackupStorageLocation: 'velero.io/v1',
|
|
862
|
+
VolumeSnapshotLocation: 'velero.io/v1',
|
|
863
|
+
Schedule: 'velero.io/v1',
|
|
864
|
+
PodVolumeBackup: 'velero.io/v1',
|
|
865
|
+
PodVolumeRestore: 'velero.io/v1',
|
|
866
|
+
};
|
|
867
|
+
return apiVersionMap[kind] || 'v1';
|
|
868
|
+
}
|
|
869
|
+
checkResourceReady(kind, resource) {
|
|
870
|
+
switch (kind) {
|
|
871
|
+
case 'Pod':
|
|
872
|
+
return resource.status?.phase === 'Running';
|
|
873
|
+
case 'Deployment':
|
|
874
|
+
case 'StatefulSet': {
|
|
875
|
+
const desired = resource.spec?.replicas ?? 0;
|
|
876
|
+
const ready = resource.status?.readyReplicas ?? 0;
|
|
877
|
+
const current = resource.status?.replicas ?? 0;
|
|
878
|
+
const updated = resource.status?.updatedReplicas ?? 0;
|
|
879
|
+
const available = resource.status?.availableReplicas ?? 0;
|
|
880
|
+
const observedGen = resource.status?.observedGeneration ?? 0;
|
|
881
|
+
const generation = resource.metadata?.generation ?? 0;
|
|
882
|
+
if (desired === 0)
|
|
883
|
+
return current === 0;
|
|
884
|
+
return (observedGen >= generation &&
|
|
885
|
+
updated === desired &&
|
|
886
|
+
ready === desired &&
|
|
887
|
+
available === desired &&
|
|
888
|
+
current === updated);
|
|
889
|
+
}
|
|
890
|
+
case 'Job':
|
|
891
|
+
return resource.status?.succeeded > 0;
|
|
892
|
+
case 'Service':
|
|
893
|
+
// Services are ready when they have endpoints (for LoadBalancer, check external IP)
|
|
894
|
+
if (resource.spec?.type === 'LoadBalancer') {
|
|
895
|
+
return resource.status?.loadBalancer?.ingress?.length > 0;
|
|
896
|
+
}
|
|
897
|
+
return true; // ClusterIP and NodePort are immediately ready
|
|
898
|
+
default:
|
|
899
|
+
// For unknown types, assume ready if status exists
|
|
900
|
+
return !!resource.status;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Rewrite the kubeconfig server URL if KUBECONFIG_SERVER_OVERRIDE is set.
|
|
905
|
+
*
|
|
906
|
+
* When the API runs inside the cluster the bootstrap seeder replaces
|
|
907
|
+
* 127.0.0.1 with kubernetes.default.svc so that in-cluster DNS resolves it.
|
|
908
|
+
* In local development that address is unreachable.
|
|
909
|
+
*
|
|
910
|
+
* Set KUBECONFIG_SERVER_OVERRIDE=https://<MASTER_IP>:6443 in .env to have
|
|
911
|
+
* every kubeconfig transparently rewritten before use.
|
|
912
|
+
*
|
|
913
|
+
* Example .env:
|
|
914
|
+
* KUBECONFIG_SERVER_OVERRIDE=https://1.2.3.4:6443
|
|
915
|
+
*/
|
|
916
|
+
patchKubeconfigServer(kubeconfig) {
|
|
917
|
+
const override = process.env.KUBECONFIG_SERVER_OVERRIDE;
|
|
918
|
+
if (!override) {
|
|
919
|
+
return kubeconfig;
|
|
920
|
+
}
|
|
921
|
+
return kubeconfig.replaceAll(/server:\s*https?:\/\/[^\s]+/g, `server: ${override}`);
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Normalises the HTTP status code from a @kubernetes/client-node error.
|
|
925
|
+
* v1.x uses `error.code`; older versions used `error.statusCode`.
|
|
926
|
+
*/
|
|
927
|
+
httpCode(error) {
|
|
928
|
+
return error?.code ?? error?.statusCode;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Poll until a Secret exists and is readable in the cluster.
|
|
932
|
+
* Resolves as soon as the Secret is confirmed readable; throws on timeout.
|
|
933
|
+
* Use this to guard operations that depend on a Secret being visible to
|
|
934
|
+
* other controllers (e.g. cert-manager reading hetzner-secret before the
|
|
935
|
+
* ClusterIssuer is applied).
|
|
936
|
+
*/
|
|
937
|
+
async waitForSecret(kubeconfigContent, name, namespace, timeoutMs = 30000) {
|
|
938
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
939
|
+
const POLL_INTERVAL_MS = 2000;
|
|
940
|
+
const startTime = Date.now();
|
|
941
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
942
|
+
try {
|
|
943
|
+
await coreApi.readNamespacedSecret({ name, namespace });
|
|
944
|
+
this.logger.log(`Secret ${namespace}/${name} is ready`);
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
catch (error) {
|
|
948
|
+
if (this.httpCode(error) === 404) {
|
|
949
|
+
this.logger.debug(`Secret ${namespace}/${name} not found yet, retrying...`);
|
|
950
|
+
await this.sleep(POLL_INTERVAL_MS);
|
|
951
|
+
continue;
|
|
952
|
+
}
|
|
953
|
+
throw error;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
throw new Error(`Secret ${namespace}/${name} not ready after ${timeoutMs}ms`);
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Returns true if the Secret exists in the cluster, false if not found.
|
|
960
|
+
*/
|
|
961
|
+
async secretExists(kubeconfigContent, name, namespace) {
|
|
962
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
963
|
+
try {
|
|
964
|
+
await coreApi.readNamespacedSecret({ name, namespace });
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
catch (error) {
|
|
968
|
+
if (this.httpCode(error) === 404) {
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
971
|
+
throw error;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
// ─── Cluster resource capacity ───────────────────────────────────────────────
|
|
975
|
+
/**
|
|
976
|
+
* Sum allocatable CPU (millicores) and memory (Mi) across all READY nodes.
|
|
977
|
+
* Uses node.status.allocatable which reflects what is schedulable after
|
|
978
|
+
* OS and kubelet reserved resources.
|
|
979
|
+
*/
|
|
980
|
+
async getNodeAllocatable(kubeconfigContent) {
|
|
981
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
982
|
+
const nodes = await coreApi.listNode();
|
|
983
|
+
let totalCpu = 0;
|
|
984
|
+
let totalMemory = 0;
|
|
985
|
+
for (const node of nodes.items ?? []) {
|
|
986
|
+
// Only count nodes that are Ready
|
|
987
|
+
const readyCondition = (node.status?.conditions ?? []).find((c) => c.type === 'Ready');
|
|
988
|
+
if (readyCondition?.status !== 'True')
|
|
989
|
+
continue;
|
|
990
|
+
const allocatable = node.status?.allocatable ?? {};
|
|
991
|
+
totalCpu += this.parseCpu(allocatable['cpu'] ?? '0');
|
|
992
|
+
totalMemory += this.parseMemory(allocatable['memory'] ?? '0');
|
|
993
|
+
}
|
|
994
|
+
return { cpu: totalCpu, memory: totalMemory };
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Poll the Kubernetes API until the named node reports Ready=True or the
|
|
998
|
+
* timeout expires. Used after a scale-node action (power_on) to confirm the
|
|
999
|
+
* node rejoined the cluster.
|
|
1000
|
+
*/
|
|
1001
|
+
async waitForNodeReady(kubeconfigContent, nodeName, timeoutMs = 300000, intervalMs = 5000) {
|
|
1002
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
1003
|
+
const start = Date.now();
|
|
1004
|
+
while (Date.now() - start < timeoutMs) {
|
|
1005
|
+
try {
|
|
1006
|
+
const node = await coreApi.readNode({ name: nodeName });
|
|
1007
|
+
const ready = (node.status?.conditions ?? []).find((c) => c.type === 'Ready');
|
|
1008
|
+
if (ready?.status === 'True')
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
catch (err) {
|
|
1012
|
+
if (this.httpCode(err) !== 404) {
|
|
1013
|
+
this.logger.warn(`waitForNodeReady poll error on ${nodeName}: ${err.message}`);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
1017
|
+
}
|
|
1018
|
+
throw new Error(`Node ${nodeName} did not reach Ready=True within ${Math.round(timeoutMs / 1000)}s`);
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Mark a node unschedulable. Existing pods continue to run; new ones are
|
|
1022
|
+
* not placed on it. Used as a precaution before power-cycling a node during
|
|
1023
|
+
* scale-node operations.
|
|
1024
|
+
*/
|
|
1025
|
+
async cordonNode(kubeconfigContent, nodeName) {
|
|
1026
|
+
await this.setNodeUnschedulable(kubeconfigContent, nodeName, true);
|
|
1027
|
+
}
|
|
1028
|
+
async uncordonNode(kubeconfigContent, nodeName) {
|
|
1029
|
+
await this.setNodeUnschedulable(kubeconfigContent, nodeName, false);
|
|
1030
|
+
}
|
|
1031
|
+
async setNodeUnschedulable(kubeconfigContent, nodeName, unschedulable) {
|
|
1032
|
+
const kc = this.loadKubeconfig(kubeconfigContent);
|
|
1033
|
+
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
|
|
1034
|
+
const patch = {
|
|
1035
|
+
apiVersion: 'v1',
|
|
1036
|
+
kind: 'Node',
|
|
1037
|
+
metadata: { name: nodeName },
|
|
1038
|
+
spec: { unschedulable },
|
|
1039
|
+
};
|
|
1040
|
+
await client.patch(patch, undefined, undefined, 'flui-api', undefined, k8s.PatchStrategy.MergePatch);
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Sum resource requests (CPU in millicores, memory in Mi) across all
|
|
1044
|
+
* containers in Running pods across all namespaces.
|
|
1045
|
+
*/
|
|
1046
|
+
async getPodResourceRequests(kubeconfigContent) {
|
|
1047
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
1048
|
+
const pods = await coreApi.listPodForAllNamespaces();
|
|
1049
|
+
let totalCpu = 0;
|
|
1050
|
+
let totalMemory = 0;
|
|
1051
|
+
for (const pod of pods.items ?? []) {
|
|
1052
|
+
if (pod.status?.phase !== 'Running')
|
|
1053
|
+
continue;
|
|
1054
|
+
for (const container of pod.spec?.containers ?? []) {
|
|
1055
|
+
const requests = container.resources?.requests ?? {};
|
|
1056
|
+
totalCpu += this.parseCpu(requests['cpu'] ?? '0');
|
|
1057
|
+
totalMemory += this.parseMemory(requests['memory'] ?? '0');
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
return { cpu: totalCpu, memory: totalMemory };
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Returns allocatable and currently-requested resources on the master
|
|
1064
|
+
* (control-plane) node. Used to gate scheduling of pods that are pinned
|
|
1065
|
+
* to the master via `persistenceScope=dedicated`. CPU in millicores, memory in Mi.
|
|
1066
|
+
*/
|
|
1067
|
+
async getMasterNodeCapacity(kubeconfigContent) {
|
|
1068
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
1069
|
+
const nodes = await coreApi.listNode();
|
|
1070
|
+
const master = (nodes.items ?? []).find((n) => {
|
|
1071
|
+
const labels = n.metadata?.labels ?? {};
|
|
1072
|
+
return (labels['node-role.kubernetes.io/control-plane'] === 'true' ||
|
|
1073
|
+
labels['node-role.kubernetes.io/master'] === 'true' ||
|
|
1074
|
+
'node-role.kubernetes.io/control-plane' in labels ||
|
|
1075
|
+
'node-role.kubernetes.io/master' in labels);
|
|
1076
|
+
});
|
|
1077
|
+
if (!master)
|
|
1078
|
+
return null;
|
|
1079
|
+
return this.getNodeCapacityByName(kubeconfigContent, master.metadata?.name ?? '');
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Allocatable + currently-requested resources on a specific node by name.
|
|
1083
|
+
* Returns null if the node is not found. Used by placement prechecks for
|
|
1084
|
+
* `persistenceScope=dedicated` apps that may target the master or a
|
|
1085
|
+
* specific worker.
|
|
1086
|
+
*/
|
|
1087
|
+
async getNodeCapacityByName(kubeconfigContent, nodeName) {
|
|
1088
|
+
if (!nodeName)
|
|
1089
|
+
return null;
|
|
1090
|
+
const { coreApi } = this.getKubeClient(kubeconfigContent);
|
|
1091
|
+
const nodes = await coreApi.listNode();
|
|
1092
|
+
const node = (nodes.items ?? []).find((n) => n.metadata?.name === nodeName);
|
|
1093
|
+
if (!node)
|
|
1094
|
+
return null;
|
|
1095
|
+
const alloc = node.status?.allocatable ?? {};
|
|
1096
|
+
const allocatable = {
|
|
1097
|
+
cpu: this.parseCpu(alloc['cpu'] ?? '0'),
|
|
1098
|
+
memory: this.parseMemory(alloc['memory'] ?? '0'),
|
|
1099
|
+
};
|
|
1100
|
+
const pods = await coreApi.listPodForAllNamespaces();
|
|
1101
|
+
let cpuReq = 0;
|
|
1102
|
+
let memReq = 0;
|
|
1103
|
+
for (const pod of pods.items ?? []) {
|
|
1104
|
+
if (pod.spec?.nodeName !== nodeName)
|
|
1105
|
+
continue;
|
|
1106
|
+
const phase = pod.status?.phase;
|
|
1107
|
+
if (phase !== 'Running' && phase !== 'Pending')
|
|
1108
|
+
continue;
|
|
1109
|
+
for (const container of pod.spec?.containers ?? []) {
|
|
1110
|
+
const requests = container.resources?.requests ?? {};
|
|
1111
|
+
cpuReq += this.parseCpu(requests['cpu'] ?? '0');
|
|
1112
|
+
memReq += this.parseMemory(requests['memory'] ?? '0');
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return {
|
|
1116
|
+
nodeName,
|
|
1117
|
+
allocatable,
|
|
1118
|
+
requested: { cpu: cpuReq, memory: memReq },
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Parse a Kubernetes CPU string to millicores.
|
|
1123
|
+
* Examples: "250m" → 250, "2" → 2000, "0.5" → 500
|
|
1124
|
+
*/
|
|
1125
|
+
parseCpu(value) {
|
|
1126
|
+
if (!value)
|
|
1127
|
+
return 0;
|
|
1128
|
+
if (value.endsWith('m')) {
|
|
1129
|
+
return Number.parseInt(value.slice(0, -1), 10) || 0;
|
|
1130
|
+
}
|
|
1131
|
+
return Math.round((Number.parseFloat(value) || 0) * 1000);
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Parse a Kubernetes memory string to mebibytes (Mi).
|
|
1135
|
+
* Examples: "512Mi" → 512, "1Gi" → 1024, "1073741824" → 1024 (bytes)
|
|
1136
|
+
*/
|
|
1137
|
+
parseMemory(value) {
|
|
1138
|
+
if (!value)
|
|
1139
|
+
return 0;
|
|
1140
|
+
if (value.endsWith('Ki'))
|
|
1141
|
+
return Math.round(Number.parseInt(value, 10) / 1024);
|
|
1142
|
+
if (value.endsWith('Mi'))
|
|
1143
|
+
return Number.parseInt(value, 10) || 0;
|
|
1144
|
+
if (value.endsWith('Gi'))
|
|
1145
|
+
return Math.round((Number.parseFloat(value) || 0) * 1024);
|
|
1146
|
+
if (value.endsWith('Ti'))
|
|
1147
|
+
return Math.round((Number.parseFloat(value) || 0) * 1024 * 1024);
|
|
1148
|
+
if (value.endsWith('K'))
|
|
1149
|
+
return Math.round(Number.parseInt(value, 10) / 1024);
|
|
1150
|
+
if (value.endsWith('M'))
|
|
1151
|
+
return Number.parseInt(value, 10) || 0;
|
|
1152
|
+
if (value.endsWith('G'))
|
|
1153
|
+
return Math.round((Number.parseFloat(value) || 0) * 954); // 1e9 / 1048576
|
|
1154
|
+
// Plain bytes
|
|
1155
|
+
return Math.round((Number.parseInt(value, 10) || 0) / (1024 * 1024));
|
|
1156
|
+
}
|
|
1157
|
+
sleep(ms) {
|
|
1158
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
exports.KubernetesService = KubernetesService;
|
|
1162
|
+
exports.KubernetesService = KubernetesService = KubernetesService_1 = __decorate([
|
|
1163
|
+
(0, common_1.Injectable)()
|
|
1164
|
+
], KubernetesService);
|