@catladder/cli 0.0.0-test7 → 0.0.0-update-meteor-53480fed
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/.nvmrc +1 -1
- package/README.md +6 -3
- package/bin/catenv +3 -0
- package/bin/catenv-dev +3 -0
- package/bin/catladder +1 -1
- package/bin/catladder-dev +3 -0
- package/dist/apps/catenv/catenv.d.ts +3 -0
- package/dist/apps/catenv/catenv.js +66 -0
- package/dist/apps/catenv/catenv.js.map +1 -0
- package/dist/apps/catenv/printVariables.d.ts +3 -0
- package/dist/apps/catenv/printVariables.js +115 -0
- package/dist/apps/catenv/printVariables.js.map +1 -0
- package/dist/apps/catenv/types.d.ts +5 -0
- package/dist/apps/catenv/types.js +3 -0
- package/dist/apps/catenv/types.js.map +1 -0
- package/dist/apps/catenv/utils.d.ts +12 -0
- package/dist/apps/catenv/utils.js +108 -0
- package/dist/apps/catenv/utils.js.map +1 -0
- package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
- package/dist/apps/catenv/writeDotEnvFiles.js +94 -0
- package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
- package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
- package/dist/apps/catenv/writeEnvDTs.js +114 -0
- package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +83 -0
- package/dist/apps/cli/cli.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +3 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +180 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
- package/dist/apps/cli/commands/cloudSQL/index.js +50 -0
- package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
- package/dist/apps/cli/commands/general/index.d.ts +4 -0
- package/dist/apps/cli/commands/general/index.js +216 -0
- package/dist/apps/cli/commands/general/index.js.map +1 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
- package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
- package/dist/apps/cli/commands/general/portForward.js +97 -0
- package/dist/apps/cli/commands/general/portForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/index.js +53 -0
- package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +191 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +121 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js +179 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +164 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +334 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js +121 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
- package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGetShell.js +96 -0
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
- package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandListPods.js +78 -0
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +112 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
- package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.js +84 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
- package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +100 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.js +74 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
- package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandPortForward.js +168 -0
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
- package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandSetup.js +58 -0
- package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
- package/dist/apps/cli/commands/project/index.d.ts +3 -0
- package/dist/apps/cli/commands/project/index.js +94 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/index.js +107 -0
- package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +116 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.js +118 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js +81 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js +139 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.js +69 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
- package/dist/apps/cli/config/writeConfig.d.ts +5 -0
- package/dist/apps/cli/config/writeConfig.js +106 -0
- package/dist/apps/cli/config/writeConfig.js.map +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
- package/dist/apps/cli/verify/index.d.ts +2 -0
- package/dist/apps/cli/verify/index.js +94 -0
- package/dist/apps/cli/verify/index.js.map +1 -0
- package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
- package/dist/apps/cli/verify/migration/fromv2.js +349 -0
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js +91 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
- package/dist/bundles/catenv/index.js +46512 -0
- package/dist/bundles/catenv/xdg-open +1066 -0
- package/dist/bundles/cli/clipboard_i686.exe +0 -0
- package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
- package/dist/bundles/cli/exec-child.js +39 -0
- package/dist/bundles/cli/index.js +363134 -0
- package/dist/bundles/cli/xdg-open +1066 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/catenv.d.ts +1 -0
- package/dist/catenv.js +13 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/constants.js +6 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +24 -0
- package/dist/config/getProjectConfig.js +313 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/config/parseChoice.d.ts +4 -0
- package/dist/config/parseChoice.js +9 -0
- package/dist/config/parseChoice.js.map +1 -0
- package/dist/gcloud/artifactsRegistry.d.ts +5 -0
- package/dist/gcloud/artifactsRegistry.js +59 -0
- package/dist/gcloud/artifactsRegistry.js.map +1 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +2 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js +67 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.d.ts +3 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.js +62 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -0
- package/dist/gcloud/cloudSql/startProxy.d.ts +10 -0
- package/dist/gcloud/cloudSql/startProxy.js +121 -0
- package/dist/gcloud/cloudSql/startProxy.js.map +1 -0
- package/dist/gcloud/enableServices.d.ts +3 -0
- package/dist/gcloud/enableServices.js +63 -0
- package/dist/gcloud/enableServices.js.map +1 -0
- package/dist/gcloud/openDashboard.d.ts +2 -0
- package/dist/gcloud/openDashboard.js +66 -0
- package/dist/gcloud/openDashboard.js.map +1 -0
- package/dist/gcloud/serviceAccounts.d.ts +12 -0
- package/dist/gcloud/serviceAccounts.js +144 -0
- package/dist/gcloud/serviceAccounts.js.map +1 -0
- package/dist/k8sApi/index.d.ts +8 -0
- package/dist/k8sApi/index.js +29 -0
- package/dist/k8sApi/index.js.map +1 -0
- package/dist/kubernetes/index.d.ts +3 -0
- package/dist/kubernetes/index.js +88 -0
- package/dist/kubernetes/index.js.map +1 -0
- package/dist/kubernetes/openKubernetesDashboards.d.ts +4 -0
- package/dist/kubernetes/openKubernetesDashboards.js +94 -0
- package/dist/kubernetes/openKubernetesDashboards.js.map +1 -0
- package/dist/kubernetes/portForward.d.ts +1 -0
- package/dist/kubernetes/portForward.js +55 -0
- package/dist/kubernetes/portForward.js.map +1 -0
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +6 -0
- package/dist/packageInfos.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/cluster.d.ts +3 -0
- package/dist/utils/cluster.js +68 -0
- package/dist/utils/cluster.js.map +1 -0
- package/dist/utils/editAsFile.d.ts +1 -0
- package/dist/utils/editAsFile.js +85 -0
- package/dist/utils/editAsFile.js.map +1 -0
- package/dist/utils/files.d.ts +2 -0
- package/dist/utils/files.js +83 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/getEditor.d.ts +4 -0
- package/dist/utils/getEditor.js +70 -0
- package/dist/utils/getEditor.js.map +1 -0
- package/dist/utils/gitlab.d.ts +24 -0
- package/dist/utils/gitlab.js +397 -0
- package/dist/utils/gitlab.js.map +1 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/log.js +14 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/passwordstore/index.d.ts +7 -0
- package/dist/utils/passwordstore/index.js +315 -0
- package/dist/utils/passwordstore/index.js.map +1 -0
- package/dist/utils/portForwards.d.ts +12 -0
- package/dist/utils/portForwards.js +120 -0
- package/dist/utils/portForwards.js.map +1 -0
- package/dist/utils/preferences/index.d.ts +3 -0
- package/dist/utils/preferences/index.js +119 -0
- package/dist/utils/preferences/index.js.map +1 -0
- package/dist/utils/projects/index.d.ts +5 -0
- package/dist/utils/projects/index.js +103 -0
- package/dist/utils/projects/index.js.map +1 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.js +62 -0
- package/dist/utils/promise.js.map +1 -0
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.js +81 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +32 -35
- package/scripts/bundle +4 -0
- package/src/apps/catenv/catenv.ts +14 -37
- package/src/apps/catenv/printVariables.ts +58 -0
- package/src/apps/catenv/types.ts +6 -0
- package/src/apps/catenv/utils.ts +49 -0
- package/src/apps/catenv/writeDotEnvFiles.ts +44 -0
- package/src/apps/catenv/writeEnvDTs.ts +71 -0
- package/src/apps/{shell/shell.ts → cli/cli.ts} +13 -3
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +154 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/{shell → cli}/commands/general/index.ts +16 -52
- package/src/apps/{shell → cli}/commands/general/portForward.ts +7 -6
- package/src/apps/{shell → cli}/commands/mongodb/index.ts +2 -2
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +20 -22
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +13 -11
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +65 -0
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +28 -19
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +139 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +234 -0
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +13 -15
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +8 -9
- package/src/apps/cli/commands/project/commandEnvVars.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +4 -4
- package/src/apps/cli/commands/project/commandGetShell.ts +36 -0
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +3 -2
- package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +15 -7
- package/src/apps/cli/commands/project/commandListPods.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +18 -8
- package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +32 -0
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +28 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +14 -17
- package/src/apps/cli/commands/project/commandOpenLogs.ts +21 -0
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +10 -8
- package/src/apps/cli/commands/project/commandPortForward.ts +86 -0
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
- package/src/apps/cli/commands/project/commandSetup.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +13 -12
- package/src/apps/{shell → cli}/commands/project/index.ts +10 -10
- package/src/apps/cli/commands/project/setup/index.ts +44 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +44 -0
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +140 -0
- package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
- package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +58 -0
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +32 -0
- package/src/apps/cli/config/writeConfig.ts +71 -0
- package/src/apps/cli/verify/index.ts +30 -0
- package/src/apps/cli/verify/migration/fromv2.ts +262 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +47 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
- package/src/catenv.ts +10 -0
- package/src/cli.ts +3 -0
- package/src/config/constants.ts +0 -3
- package/src/config/getProjectConfig.ts +200 -0
- package/src/config/parseChoice.ts +4 -0
- package/src/gcloud/artifactsRegistry.ts +16 -0
- package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +35 -0
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +22 -0
- package/src/gcloud/cloudSql/startProxy.ts +74 -0
- package/src/gcloud/enableServices.ts +14 -0
- package/src/gcloud/openDashboard.ts +19 -0
- package/src/gcloud/serviceAccounts.ts +101 -0
- package/src/k8sApi/index.ts +22 -6
- package/src/kubernetes/index.ts +27 -0
- package/src/kubernetes/openKubernetesDashboards.ts +52 -0
- package/src/kubernetes/portForward.ts +15 -0
- package/src/types/child-process-promise.d.ts +37 -1
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +5 -14
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +263 -42
- package/src/utils/passwordstore/index.ts +6 -36
- package/src/utils/{portForward.ts → portForwards.ts} +27 -22
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +9 -149
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
- package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
- package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
- package/src/apps/shell/commands/project/commandCopyDB.ts +0 -93
- package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
- package/src/apps/shell/commands/project/commandGetShell.ts +0 -35
- package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
- package/src/apps/shell/commands/project/commandListPods.ts +0 -21
- package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
- package/src/apps/shell/commands/project/commandOpenCostDashboard.ts +0 -29
- package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
- package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
- package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
- package/src/apps/shell/commands/project/commandPortForward.ts +0 -45
- package/src/apps/shell/commands/project/commandVariables.ts +0 -13
- package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
- package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
- package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
- package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
- package/src/apps/shell/commands/shared/index.ts +0 -31
- package/src/apps/shell/commands/theStuffThatReallyMatters/index.ts +0 -51
- package/src/config/clusters.ts +0 -45
- package/src/index.ts +0 -17
- package/src/types/git-repo-name.d.ts +0 -1
- package/src/types/yawn-yaml.d.ts +0 -1
- package/src/utils/dashboardToken.ts +0 -20
- package/src/utils/formatEnvVars.ts +0 -7
- /package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- /package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import Vorpal from "vorpal";
|
|
2
2
|
// tslint:disable-next-line:no-var-requires
|
|
3
3
|
import packageInfos from "../../packageInfos";
|
|
4
|
-
import { stopAllPortForwards } from "../../utils/
|
|
4
|
+
import { stopAllPortForwards } from "../../utils/portForwards";
|
|
5
5
|
import general from "./commands/general";
|
|
6
6
|
import mongodb from "./commands/mongodb";
|
|
7
|
+
import cloudSQL from "./commands/cloudSQL";
|
|
7
8
|
import project from "./commands/project";
|
|
8
9
|
import theStuffThatReallyMatters from "./commands/theStuffThatReallyMatters";
|
|
9
|
-
const welcomeMessage = `catladder 2 😻 version ${packageInfos.version}`;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
import { verify } from "./verify";
|
|
12
|
+
import { showProjectBanner } from "./commands/project/utils/showProjectBanner";
|
|
13
|
+
|
|
14
|
+
export default async () => {
|
|
12
15
|
const vorpal = new Vorpal();
|
|
13
16
|
|
|
17
|
+
const welcomeMessage = `catladder 2022 😻 version ${packageInfos.version}`;
|
|
18
|
+
|
|
14
19
|
vorpal
|
|
15
20
|
.delimiter("catladder $") // emoji messes with cursor :-( https://github.com/dthree/vorpal/issues/332
|
|
16
21
|
.history("catladder")
|
|
@@ -19,8 +24,13 @@ export default () => {
|
|
|
19
24
|
.log(welcomeMessage)
|
|
20
25
|
.log("");
|
|
21
26
|
|
|
27
|
+
await showProjectBanner(vorpal);
|
|
28
|
+
|
|
29
|
+
verify(vorpal);
|
|
30
|
+
|
|
22
31
|
general(vorpal);
|
|
23
32
|
project(vorpal);
|
|
33
|
+
cloudSQL(vorpal);
|
|
24
34
|
mongodb(vorpal);
|
|
25
35
|
theStuffThatReallyMatters(vorpal);
|
|
26
36
|
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { spawn } from "child-process-promise";
|
|
2
|
+
|
|
3
|
+
import type Vorpal from "vorpal";
|
|
4
|
+
import type { CloudSqlBackgroundProxy } from "../../../../gcloud/cloudSql/startProxy";
|
|
5
|
+
import { startCloudSqlProxyInBackground } from "../../../../gcloud/cloudSql/startProxy";
|
|
6
|
+
|
|
7
|
+
export default async (vorpal: Vorpal) =>
|
|
8
|
+
vorpal
|
|
9
|
+
.command(
|
|
10
|
+
"cloud-sql-restore-db",
|
|
11
|
+
"restore a db from one source to another target"
|
|
12
|
+
)
|
|
13
|
+
.action(async function restoreDb() {
|
|
14
|
+
const { sourceInstance } = await this.prompt({
|
|
15
|
+
type: "input",
|
|
16
|
+
name: "sourceInstance",
|
|
17
|
+
|
|
18
|
+
message: "Source instance (connection string or 'local')? 🤔 ",
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
let sourceProxy: CloudSqlBackgroundProxy;
|
|
22
|
+
|
|
23
|
+
let targetProxy: CloudSqlBackgroundProxy;
|
|
24
|
+
|
|
25
|
+
let sourcePort: number;
|
|
26
|
+
let targetPort: number;
|
|
27
|
+
|
|
28
|
+
if (sourceInstance === "local") {
|
|
29
|
+
const { sourceLocalPort } = await this.prompt({
|
|
30
|
+
type: "number",
|
|
31
|
+
name: "sourceLocalPort",
|
|
32
|
+
default: 5432,
|
|
33
|
+
|
|
34
|
+
message: "Local Port for source? 🤔 ",
|
|
35
|
+
});
|
|
36
|
+
sourcePort = sourceLocalPort;
|
|
37
|
+
} else {
|
|
38
|
+
sourcePort = 54399;
|
|
39
|
+
sourceProxy = await startCloudSqlProxyInBackground({
|
|
40
|
+
instanceName: sourceInstance,
|
|
41
|
+
localPort: sourcePort,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const { sourceUsername } = await this.prompt({
|
|
46
|
+
type: "input",
|
|
47
|
+
name: "sourceUsername",
|
|
48
|
+
default: "postgres",
|
|
49
|
+
|
|
50
|
+
message: "Source Username? 🤔 ",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const { sourcePassword } = await this.prompt({
|
|
54
|
+
type: "input",
|
|
55
|
+
name: "sourcePassword",
|
|
56
|
+
|
|
57
|
+
message: "Source Password? 🤔 ",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const { sourceDbName } = await this.prompt({
|
|
61
|
+
type: "input",
|
|
62
|
+
name: "sourceDbName",
|
|
63
|
+
|
|
64
|
+
message: "Source DB name? 🤔 ",
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const { targetInstance } = await this.prompt({
|
|
68
|
+
type: "input",
|
|
69
|
+
name: "targetInstance",
|
|
70
|
+
|
|
71
|
+
message: "Target INSTANCE (connection string or 'local')? 🤔 ",
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (targetInstance === "local") {
|
|
75
|
+
const { targetLocalPort } = await this.prompt({
|
|
76
|
+
type: "number",
|
|
77
|
+
name: "targetLocalPort",
|
|
78
|
+
default: 5432,
|
|
79
|
+
|
|
80
|
+
message: "Local Port for target? 🤔 ",
|
|
81
|
+
});
|
|
82
|
+
targetPort = targetLocalPort;
|
|
83
|
+
} else {
|
|
84
|
+
targetPort = 54499;
|
|
85
|
+
targetProxy = await startCloudSqlProxyInBackground({
|
|
86
|
+
instanceName: targetInstance,
|
|
87
|
+
localPort: targetPort,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const { targetUsername } = await this.prompt({
|
|
92
|
+
type: "input",
|
|
93
|
+
name: "targetUsername",
|
|
94
|
+
default: "postgres",
|
|
95
|
+
|
|
96
|
+
message: "Target Username? 🤔 ",
|
|
97
|
+
});
|
|
98
|
+
const { targetPassword } = await this.prompt({
|
|
99
|
+
type: "input",
|
|
100
|
+
name: "targetPassword",
|
|
101
|
+
|
|
102
|
+
message: "Target Password? 🤔 ",
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const { targetDbName } = await this.prompt({
|
|
106
|
+
type: "input",
|
|
107
|
+
name: "targetDbName",
|
|
108
|
+
|
|
109
|
+
message: "Target DB name? 🤔 ",
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const { shouldContinue } = await this.prompt({
|
|
113
|
+
type: "confirm",
|
|
114
|
+
name: "shouldContinue",
|
|
115
|
+
message: `This will drop ${targetInstance}/${targetDbName} and replace it with ${sourceInstance}/${sourceDbName}. Continue? 🤔 `,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (!shouldContinue) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const targetPSQL = (command: string) =>
|
|
123
|
+
`PGPASSWORD=${targetPassword} psql -p ${targetPort} --host=localhost --user=${targetUsername} -q ${command}`;
|
|
124
|
+
|
|
125
|
+
const copyDBScript = `
|
|
126
|
+
set -e
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
dumptmp=$(mktemp /tmp/dump.XXXXXX)
|
|
131
|
+
|
|
132
|
+
echo "Dumping file to $dumptmp"
|
|
133
|
+
pg_dump --dbname=postgres://${sourceUsername}:${sourcePassword}@localhost:${sourcePort}/${sourceDbName} --no-owner --no-privileges > $dumptmp
|
|
134
|
+
echo "dump done"
|
|
135
|
+
${targetPSQL(
|
|
136
|
+
`-c 'drop database "${targetDbName}" WITH (FORCE)' 1> /dev/null || true`
|
|
137
|
+
)}
|
|
138
|
+
${targetPSQL(`-c 'create database "${targetDbName}"' 1> /dev/null`)}
|
|
139
|
+
echo "Restoring dump..."
|
|
140
|
+
${targetPSQL(`"${targetDbName}" < $dumptmp 1> /dev/null`)}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
echo "Clean up..."
|
|
144
|
+
set +e
|
|
145
|
+
rm $dumptmp
|
|
146
|
+
echo "\n🐱 Done!"
|
|
147
|
+
`;
|
|
148
|
+
try {
|
|
149
|
+
await spawn(copyDBScript, [], { shell: "bash", stdio: "inherit" });
|
|
150
|
+
} finally {
|
|
151
|
+
sourceProxy?.stop();
|
|
152
|
+
targetProxy?.stop();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
@@ -1,29 +1,20 @@
|
|
|
1
1
|
import memoizee from "memoizee";
|
|
2
|
-
import Vorpal from "vorpal";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
connectToCluster,
|
|
6
|
-
getAllClusterNames,
|
|
7
|
-
getCurrentConnectedClusterName,
|
|
8
|
-
getCurrentContext,
|
|
9
|
-
} from "../../../../utils/cluster";
|
|
2
|
+
import type Vorpal from "vorpal";
|
|
3
|
+
import { getk8sApi } from "../../../../k8sApi";
|
|
4
|
+
import { getCurrentContext } from "../../../../utils/cluster";
|
|
10
5
|
import { logError } from "../../../../utils/log";
|
|
11
6
|
import { syncBitwarden } from "../../../../utils/passwordstore";
|
|
12
7
|
import {
|
|
13
8
|
getAllRunningPortForwards,
|
|
14
9
|
stopPortForward,
|
|
15
|
-
} from "../../../../utils/
|
|
10
|
+
} from "../../../../utils/portForwards";
|
|
16
11
|
import { getShell } from "../../../../utils/shell";
|
|
17
|
-
import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
|
|
18
|
-
import {
|
|
19
|
-
openGoogleCloudKubernetesDashboard,
|
|
20
|
-
openGoogleCloudLogs,
|
|
21
|
-
} from "../shared";
|
|
22
12
|
import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
|
|
23
13
|
import portForward from "./portForward";
|
|
24
14
|
|
|
25
15
|
const getAllNamespaces = memoizee(
|
|
26
16
|
async () => {
|
|
17
|
+
const k8sApi = getk8sApi();
|
|
27
18
|
const res = await k8sApi.listNamespace();
|
|
28
19
|
return res.body.items;
|
|
29
20
|
},
|
|
@@ -34,29 +25,23 @@ export const getAllNamespacesNames = async () => {
|
|
|
34
25
|
const namespaces = await getAllNamespaces();
|
|
35
26
|
return namespaces.map((n) => n.metadata.name);
|
|
36
27
|
};
|
|
37
|
-
export default (vorpal: Vorpal) => {
|
|
38
|
-
vorpal
|
|
39
|
-
.command("connect-cluster <clustername>")
|
|
40
|
-
.autocomplete(getAllClusterNames())
|
|
41
|
-
.action(async function ({ clustername }) {
|
|
42
|
-
this.log(`connecting to ${clustername}`);
|
|
43
|
-
await connectToCluster(clustername);
|
|
44
|
-
});
|
|
45
|
-
vorpal.command("current-context").action(async function () {
|
|
28
|
+
export default async (vorpal: Vorpal) => {
|
|
29
|
+
vorpal.command("kube-current-context").action(async function () {
|
|
46
30
|
this.log(await getCurrentContext());
|
|
47
31
|
});
|
|
48
32
|
|
|
49
33
|
vorpal
|
|
50
|
-
.command("list-namespaces", "list all namespaces")
|
|
34
|
+
.command("kube-list-namespaces", "list all namespaces")
|
|
51
35
|
.action(async function () {
|
|
52
36
|
const namespaces = await getAllNamespacesNames();
|
|
53
37
|
this.log(namespaces.join("\n"));
|
|
54
38
|
});
|
|
55
39
|
|
|
56
40
|
vorpal
|
|
57
|
-
.command("list-secrets <namespace>", "show secrets")
|
|
41
|
+
.command("kube-list-secrets <namespace>", "show secrets")
|
|
58
42
|
.autocomplete(namespaceAutoCompletion)
|
|
59
43
|
.action(async function ({ namespace }) {
|
|
44
|
+
const k8sApi = getk8sApi();
|
|
60
45
|
const res = await k8sApi.listNamespacedSecret(namespace);
|
|
61
46
|
|
|
62
47
|
this.log(res.body.items.map((n) => n.metadata.name).join("\n"));
|
|
@@ -68,50 +53,29 @@ export default (vorpal: Vorpal) => {
|
|
|
68
53
|
});
|
|
69
54
|
|
|
70
55
|
vorpal
|
|
71
|
-
.command("list-pods <namespace>", "list all pods of namespace")
|
|
56
|
+
.command("kube-list-pods <namespace>", "list all pods of namespace")
|
|
72
57
|
.autocomplete(namespaceAutoCompletion)
|
|
73
58
|
.action(async function ({ namespace }) {
|
|
59
|
+
const k8sApi = getk8sApi();
|
|
74
60
|
const res = await k8sApi.listNamespacedPod(namespace);
|
|
75
61
|
this.log(res.body.items.map((n) => n.metadata.name).join("\n"));
|
|
76
62
|
});
|
|
77
63
|
|
|
78
64
|
vorpal
|
|
79
|
-
.command("stop-portforward <name>", "stop a running port forward")
|
|
65
|
+
.command("kube-stop-portforward <name>", "stop a running port forward")
|
|
80
66
|
.autocomplete({ data: async () => getAllRunningPortForwards() })
|
|
81
67
|
.action(async function ({ name }) {
|
|
82
68
|
stopPortForward(name.trim());
|
|
83
69
|
});
|
|
84
70
|
|
|
85
|
-
vorpal
|
|
86
|
-
.command("open-dashboard <namespace>", "open kubernetes dashboard")
|
|
87
|
-
.autocomplete(namespaceAutoCompletion)
|
|
88
|
-
.action(async function ({ namespace }) {
|
|
89
|
-
const clustername = await getCurrentConnectedClusterName();
|
|
90
|
-
const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
|
|
91
|
-
|
|
92
|
-
await openGoogleCloudKubernetesDashboard(
|
|
93
|
-
authGoogleNumber,
|
|
94
|
-
clustername,
|
|
95
|
-
namespace
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
71
|
vorpal
|
|
99
72
|
.command(
|
|
100
|
-
"
|
|
101
|
-
"
|
|
73
|
+
"kube-get-shell <namespace>",
|
|
74
|
+
"get a shell to a pod in the environment"
|
|
102
75
|
)
|
|
103
76
|
.autocomplete(namespaceAutoCompletion)
|
|
104
77
|
.action(async function ({ namespace }) {
|
|
105
|
-
const
|
|
106
|
-
const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
|
|
107
|
-
|
|
108
|
-
await openGoogleCloudLogs(authGoogleNumber, clustername, namespace);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
vorpal
|
|
112
|
-
.command("get-shell <namespace>", "get a shell to a pod in the environment")
|
|
113
|
-
.autocomplete(namespaceAutoCompletion)
|
|
114
|
-
.action(async function ({ namespace }) {
|
|
78
|
+
const k8sApi = getk8sApi();
|
|
115
79
|
const res = await k8sApi.listNamespacedPod(namespace);
|
|
116
80
|
if (res.body.items.length === 0) {
|
|
117
81
|
logError(this, "sorry, no pods found");
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
2
|
import { logError } from "../../../../utils/log";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { startKubePortForward } from "../../../../kubernetes/portForward";
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { getk8sApi } from "../../../../k8sApi";
|
|
7
7
|
import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
|
|
8
8
|
|
|
9
|
-
export default (vorpal: Vorpal) =>
|
|
9
|
+
export default async (vorpal: Vorpal) =>
|
|
10
10
|
vorpal
|
|
11
|
-
.command("port-forward <namespace>", "start port-forwarding")
|
|
11
|
+
.command("kube-port-forward <namespace>", "start port-forwarding")
|
|
12
12
|
.autocomplete(namespaceAutoCompletion)
|
|
13
13
|
.action(async function ({ namespace }) {
|
|
14
|
+
const k8sApi = getk8sApi();
|
|
14
15
|
const res = await k8sApi.listNamespacedPod(namespace);
|
|
15
16
|
if (res.body.items.length === 0) {
|
|
16
17
|
logError(this, "sorry, no pods found");
|
|
@@ -43,5 +44,5 @@ export default (vorpal: Vorpal) =>
|
|
|
43
44
|
message: "Remote port: ",
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
return
|
|
47
|
+
return startKubePortForward(podName, localPort, remotePort, namespace);
|
|
47
48
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
2
|
import projectMongoDestroyMember from "./projectMongoDestroyMember";
|
|
3
3
|
import projectMongoGetShell from "./projectMongoGetShell";
|
|
4
4
|
import projectMongoPortForward from "./projectMongoPortForward";
|
|
5
5
|
|
|
6
|
-
export default (vorpal: Vorpal) => {
|
|
6
|
+
export default async (vorpal: Vorpal) => {
|
|
7
7
|
projectMongoGetShell(vorpal);
|
|
8
8
|
projectMongoPortForward(vorpal);
|
|
9
9
|
projectMongoDestroyMember(vorpal);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { exec } from "child-process-promise";
|
|
2
|
-
import Vorpal from "vorpal";
|
|
2
|
+
import type Vorpal from "vorpal";
|
|
3
|
+
import { getProjectPvcs } from "../../../../kubernetes";
|
|
3
4
|
import { logError } from "../../../../utils/log";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
getProjectPvcs
|
|
7
|
-
} from "../../../../utils/projects";
|
|
8
|
-
import { envAutocompletion } from "../project/utils/autocompletions";
|
|
5
|
+
import { getProjectNamespace } from "../../../../utils/projects";
|
|
6
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
9
7
|
import ensureCluster from "../project/utils/ensureCluster";
|
|
10
8
|
import { getMongoDbPodsWithReplInfo } from "./utils";
|
|
11
9
|
|
|
@@ -31,18 +29,18 @@ const removeFinalizerAndDelete = async (
|
|
|
31
29
|
) => {
|
|
32
30
|
return Promise.all([
|
|
33
31
|
removeFinalizer(namespace, type, name),
|
|
34
|
-
await deleteResource(namespace, type, name)
|
|
32
|
+
await deleteResource(namespace, type, name),
|
|
35
33
|
]);
|
|
36
34
|
};
|
|
37
|
-
export default (vorpal: Vorpal) =>
|
|
35
|
+
export default async (vorpal: Vorpal) =>
|
|
38
36
|
vorpal
|
|
39
37
|
.command(
|
|
40
|
-
"project-mongo-destroy-member <
|
|
38
|
+
"project-mongo-destroy-member <envComponent>",
|
|
41
39
|
"DESTROY a member of a replicaset in order to reinitialize it"
|
|
42
40
|
)
|
|
43
|
-
.autocomplete(
|
|
44
|
-
.action(async function({
|
|
45
|
-
await ensureCluster.call(this);
|
|
41
|
+
.autocomplete(await envAndComponents())
|
|
42
|
+
.action(async function ({ envComponent }) {
|
|
43
|
+
await ensureCluster.call(this, envComponent);
|
|
46
44
|
this.log(
|
|
47
45
|
"this command tries to delete a (secondary) member of the replicaset, it's persistent volume claim (pvc) and the volume"
|
|
48
46
|
);
|
|
@@ -67,18 +65,18 @@ export default (vorpal: Vorpal) =>
|
|
|
67
65
|
default: true,
|
|
68
66
|
message: "DO YOU UNDERSTAND?",
|
|
69
67
|
name: "understood",
|
|
70
|
-
type: "confirm"
|
|
68
|
+
type: "confirm",
|
|
71
69
|
});
|
|
72
70
|
|
|
73
71
|
if (!understood) {
|
|
74
72
|
throw new Error("abort");
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
const namespace = await getProjectNamespace(
|
|
78
|
-
const mongodbPods = await getMongoDbPodsWithReplInfo(
|
|
75
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
76
|
+
const mongodbPods = await getMongoDbPodsWithReplInfo(envComponent);
|
|
79
77
|
|
|
80
|
-
const pvcs = await getProjectPvcs(
|
|
81
|
-
const secondaries = mongodbPods.filter(pod => !pod.isMaster);
|
|
78
|
+
const pvcs = await getProjectPvcs(envComponent);
|
|
79
|
+
const secondaries = mongodbPods.filter((pod) => !pod.isMaster);
|
|
82
80
|
|
|
83
81
|
if (secondaries.length === 0) {
|
|
84
82
|
logError(this, "sorry, no pods found");
|
|
@@ -89,16 +87,16 @@ export default (vorpal: Vorpal) =>
|
|
|
89
87
|
await this.prompt({
|
|
90
88
|
type: "list",
|
|
91
89
|
name: "podName",
|
|
92
|
-
choices: secondaries.map(p => ({
|
|
90
|
+
choices: secondaries.map((p) => ({
|
|
93
91
|
name: `[ secondary ] ${p.podName}`,
|
|
94
|
-
value: p.podName
|
|
92
|
+
value: p.podName,
|
|
95
93
|
})),
|
|
96
|
-
message: "Which pod? 🤔"
|
|
94
|
+
message: "Which pod? 🤔",
|
|
97
95
|
})
|
|
98
96
|
).podName;
|
|
99
97
|
|
|
100
98
|
const thePvc = pvcs.find(
|
|
101
|
-
pvc => pvc.metadata.name === `datadir-${podName}`
|
|
99
|
+
(pvc) => pvc.metadata.name === `datadir-${podName}`
|
|
102
100
|
);
|
|
103
101
|
if (!thePvc) {
|
|
104
102
|
logError(this, `sorry, no pvc found for ${podName}`);
|
|
@@ -109,7 +107,7 @@ export default (vorpal: Vorpal) =>
|
|
|
109
107
|
message:
|
|
110
108
|
"THIS WILL DESTROY THE POD, ITS VOLUME AND ALL ITS DATA 🙀🙀🙀!!! continue? 🤔",
|
|
111
109
|
name: "shouldContinue",
|
|
112
|
-
type: "confirm"
|
|
110
|
+
type: "confirm",
|
|
113
111
|
});
|
|
114
112
|
|
|
115
113
|
if (!shouldContinue) {
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import Vorpal from "vorpal";
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
2
|
import { logError } from "../../../../utils/log";
|
|
3
3
|
import { getProjectNamespace } from "../../../../utils/projects";
|
|
4
|
-
import {
|
|
4
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
5
5
|
import ensureCluster from "../project/utils/ensureCluster";
|
|
6
6
|
import {
|
|
7
7
|
getMongodbShell,
|
|
8
|
-
getProjectMongodbAllPodsSortedWithLabel
|
|
8
|
+
getProjectMongodbAllPodsSortedWithLabel,
|
|
9
9
|
} from "./utils";
|
|
10
10
|
|
|
11
|
-
export default (vorpal: Vorpal) =>
|
|
11
|
+
export default async (vorpal: Vorpal) =>
|
|
12
12
|
vorpal
|
|
13
13
|
.command(
|
|
14
|
-
"project-mongo-get-shell <
|
|
14
|
+
"project-mongo-get-shell <envComponent>",
|
|
15
15
|
"get a shell to a mongodb in the environment"
|
|
16
16
|
)
|
|
17
|
-
.autocomplete(
|
|
18
|
-
.action(async function({
|
|
19
|
-
await ensureCluster.call(this);
|
|
20
|
-
const namespace = await getProjectNamespace(
|
|
21
|
-
const podNames = await getProjectMongodbAllPodsSortedWithLabel(
|
|
17
|
+
.autocomplete(await envAndComponents())
|
|
18
|
+
.action(async function ({ envComponent }) {
|
|
19
|
+
await ensureCluster.call(this, envComponent);
|
|
20
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
21
|
+
const podNames = await getProjectMongodbAllPodsSortedWithLabel(
|
|
22
|
+
envComponent
|
|
23
|
+
);
|
|
22
24
|
if (podNames.length === 0) {
|
|
23
25
|
logError(this, "sorry, no pods found");
|
|
24
26
|
return;
|
|
@@ -32,7 +34,7 @@ export default (vorpal: Vorpal) =>
|
|
|
32
34
|
type: "list",
|
|
33
35
|
name: "podName",
|
|
34
36
|
choices: podNames,
|
|
35
|
-
message: "Which pod? 🤔"
|
|
37
|
+
message: "Which pod? 🤔",
|
|
36
38
|
})
|
|
37
39
|
).podName;
|
|
38
40
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type Vorpal from "vorpal";
|
|
2
|
+
import {
|
|
3
|
+
getEnvVarsResolved,
|
|
4
|
+
parseChoice,
|
|
5
|
+
} from "../../../../config/getProjectConfig";
|
|
6
|
+
import { logError } from "../../../../utils/log";
|
|
7
|
+
import { startKubePortForward } from "../../../../kubernetes/portForward";
|
|
8
|
+
import { getProjectNamespace } from "../../../../utils/projects";
|
|
9
|
+
import { envAndComponents } from "../project/utils/autocompletions";
|
|
10
|
+
import ensureCluster from "../project/utils/ensureCluster";
|
|
11
|
+
import { getProjectMongodbAllPodsSortedWithLabel } from "./utils";
|
|
12
|
+
import clipboard from "clipboardy";
|
|
13
|
+
|
|
14
|
+
export default async (vorpal: Vorpal) =>
|
|
15
|
+
vorpal
|
|
16
|
+
.command(
|
|
17
|
+
"project-mongo-port-forward <envComponent>",
|
|
18
|
+
"port foward to a mongodb"
|
|
19
|
+
)
|
|
20
|
+
.autocomplete(await envAndComponents())
|
|
21
|
+
.action(async function ({ envComponent }) {
|
|
22
|
+
await ensureCluster.call(this, envComponent);
|
|
23
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
24
|
+
const podNames = await getProjectMongodbAllPodsSortedWithLabel(
|
|
25
|
+
envComponent
|
|
26
|
+
);
|
|
27
|
+
if (podNames.length === 0) {
|
|
28
|
+
logError(this, "sorry, no pods found");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let podName;
|
|
32
|
+
if (podNames.length === 1) {
|
|
33
|
+
podName = podNames[0].value;
|
|
34
|
+
} else {
|
|
35
|
+
podName = (
|
|
36
|
+
await this.prompt({
|
|
37
|
+
type: "list",
|
|
38
|
+
name: "podName",
|
|
39
|
+
choices: podNames,
|
|
40
|
+
message: "Which pod? 🤔",
|
|
41
|
+
})
|
|
42
|
+
).podName;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const { localPort } = await this.prompt({
|
|
46
|
+
type: "number",
|
|
47
|
+
name: "localPort",
|
|
48
|
+
default: "30000",
|
|
49
|
+
message: "Local port: ",
|
|
50
|
+
});
|
|
51
|
+
const { env, componentName } = parseChoice(envComponent);
|
|
52
|
+
const envVars = await getEnvVarsResolved(this, env, componentName);
|
|
53
|
+
const MONGODB_ROOT_PASSWORD = envVars?.MONGODB_ROOT_PASSWORD;
|
|
54
|
+
const connectionUrl = `mongodb://root:${MONGODB_ROOT_PASSWORD}@localhost:${localPort}`;
|
|
55
|
+
clipboard.writeSync(connectionUrl);
|
|
56
|
+
this.log("");
|
|
57
|
+
this.log("username: root");
|
|
58
|
+
this.log(`password: ${MONGODB_ROOT_PASSWORD}`);
|
|
59
|
+
this.log(`connection string: ${connectionUrl}`);
|
|
60
|
+
this.log("");
|
|
61
|
+
this.log("👆 connection string has been copied to your clipboard!");
|
|
62
|
+
this.log("");
|
|
63
|
+
|
|
64
|
+
return startKubePortForward(podName, localPort, 27017, namespace);
|
|
65
|
+
});
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { exec, spawn } from "child-process-promise";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
getProjectNamespace,
|
|
5
|
-
getProjectPodNames,
|
|
6
|
-
} from "../../../../../utils/projects";
|
|
2
|
+
import { getProjectPodNames } from "../../../../../kubernetes";
|
|
3
|
+
import { getProjectNamespace } from "../../../../../utils/projects";
|
|
7
4
|
|
|
8
5
|
const filterMongoDbs = (podNames: string[]) =>
|
|
9
|
-
podNames.filter(
|
|
6
|
+
podNames.filter(
|
|
7
|
+
(name) =>
|
|
8
|
+
name.includes("mongodb") &&
|
|
9
|
+
!name.includes("mongodb-backup") &&
|
|
10
|
+
!name.includes("arbiter")
|
|
11
|
+
);
|
|
10
12
|
|
|
11
|
-
export const getProjectMongodbAllPods = async (
|
|
12
|
-
filterMongoDbs(await getProjectPodNames(
|
|
13
|
+
export const getProjectMongodbAllPods = async (envComponent: string) =>
|
|
14
|
+
filterMongoDbs(await getProjectPodNames(envComponent));
|
|
13
15
|
|
|
14
16
|
export const getMongodbShell = async (namespace: string, podName: string) => {
|
|
15
17
|
const command = `kubectl exec -it ${podName} --namespace ${namespace} mongo`;
|
|
@@ -44,23 +46,28 @@ export const executeMongodbCommand = async (
|
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
export const podIsMaster = async (namespace: string, podName: string) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
try {
|
|
50
|
+
const result = await executeMongodbCommand(
|
|
51
|
+
namespace,
|
|
52
|
+
podName,
|
|
53
|
+
"db.isMaster()"
|
|
54
|
+
);
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
return result.ismaster;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// maybe shutting down ?
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
54
61
|
};
|
|
55
62
|
|
|
56
63
|
const spaces = (n: number) => " ".repeat(n);
|
|
57
64
|
|
|
58
|
-
export const getMongoDbPodsWithReplInfo = async (
|
|
59
|
-
const namespace = await getProjectNamespace(
|
|
65
|
+
export const getMongoDbPodsWithReplInfo = async (envComponent: string) => {
|
|
66
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
60
67
|
return (
|
|
61
68
|
await Promise.all(
|
|
62
69
|
(
|
|
63
|
-
await getProjectMongodbAllPods(
|
|
70
|
+
await getProjectMongodbAllPods(envComponent)
|
|
64
71
|
).map(async (podName) => ({
|
|
65
72
|
podName,
|
|
66
73
|
componentName: podName.replace(/-mongodb-replicaset-[0-9]+/, ""),
|
|
@@ -70,8 +77,10 @@ export const getMongoDbPodsWithReplInfo = async (env: Env) => {
|
|
|
70
77
|
).sort((podA, podB) => (podA.isMaster ? (podB.isMaster ? 0 : -1) : 1));
|
|
71
78
|
};
|
|
72
79
|
|
|
73
|
-
export const getProjectMongodbAllPodsSortedWithLabel = async (
|
|
74
|
-
|
|
80
|
+
export const getProjectMongodbAllPodsSortedWithLabel = async (
|
|
81
|
+
envComponent: string
|
|
82
|
+
) => {
|
|
83
|
+
const pods = await getMongoDbPodsWithReplInfo(envComponent);
|
|
75
84
|
const maxComponentNameLength = Math.max(
|
|
76
85
|
...pods.map((c) => c.componentName.length)
|
|
77
86
|
);
|