@catladder/cli 0.0.0-test7 → 0.0.0-waitfor-deploy-e64a33ba
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/catladder +1 -1
- package/dist/apps/catenv/catenv.d.ts +5 -0
- package/dist/apps/catenv/catenv.js +143 -0
- package/dist/apps/catenv/catenv.js.map +1 -0
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +81 -0
- package/dist/apps/cli/cli.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 +190 -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 +105 -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 +167 -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 +137 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +4 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +320 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js +120 -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 +92 -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 +113 -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 +85 -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 +61 -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 +99 -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 +87 -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 +106 -0
- package/dist/apps/cli/commands/project/commandPortForward.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 +103 -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 +115 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.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 +74 -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 +132 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.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/shared/index.d.ts +3 -0
- package/dist/apps/cli/commands/shared/index.js +70 -0
- package/dist/apps/cli/commands/shared/index.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 +347 -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 +88 -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/catenv.d.ts +1 -0
- package/dist/catenv.js +15 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/constants.d.ts +3 -0
- package/dist/config/constants.js +7 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +24 -0
- package/dist/config/getProjectConfig.js +259 -0
- package/dist/config/getProjectConfig.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/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 +73 -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 +22 -0
- package/dist/utils/gitlab.js +278 -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 +8 -0
- package/dist/utils/passwordstore/index.js +378 -0
- package/dist/utils/passwordstore/index.js.map +1 -0
- package/dist/utils/portForward.d.ts +4 -0
- package/dist/utils/portForward.js +116 -0
- package/dist/utils/portForward.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 +8 -0
- package/dist/utils/projects/index.js +153 -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 +16 -21
- package/src/apps/catenv/catenv.ts +55 -27
- package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
- package/src/apps/{shell → cli}/commands/general/index.ts +7 -46
- package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- package/src/apps/{shell → cli}/commands/general/portForward.ts +3 -2
- package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +88 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +220 -0
- package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +24 -26
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
- package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
- package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
- package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +14 -6
- package/src/apps/cli/commands/project/commandListPods.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
- package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +48 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
- package/src/apps/cli/commands/project/commandOpenLogs.ts +52 -0
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
- package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
- package/src/apps/cli/commands/project/commandSetup.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/index.ts +6 -7
- package/src/apps/cli/commands/project/setup/index.ts +42 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +72 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +37 -0
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +112 -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 +56 -0
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/cli/commands/shared/index.ts +36 -0
- package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
- package/src/apps/cli/config/writeConfig.ts +71 -0
- package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
- package/src/apps/cli/verify/index.ts +30 -0
- package/src/apps/cli/verify/migration/fromv2.ts +264 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
- package/src/catenv.ts +11 -0
- package/src/cli.ts +9 -0
- package/src/config/constants.ts +0 -1
- package/src/config/getProjectConfig.ts +160 -0
- package/src/k8sApi/index.ts +22 -6
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +6 -15
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +144 -34
- package/src/utils/passwordstore/index.ts +19 -21
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +18 -137
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- 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/commandEnvVars.ts +0 -17
- 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/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/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/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
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
17
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
18
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
+
function step(op) {
|
|
20
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
+
while (_) try {
|
|
22
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
+
switch (op[0]) {
|
|
25
|
+
case 0: case 1: t = op; break;
|
|
26
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
+
default:
|
|
30
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
+
if (t[2]) _.ops.pop();
|
|
35
|
+
_.trys.pop(); continue;
|
|
36
|
+
}
|
|
37
|
+
op = body.call(thisArg, _);
|
|
38
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
45
|
+
exports.__esModule = true;
|
|
46
|
+
exports.setupKubernetes = void 0;
|
|
47
|
+
var pipeline_1 = require("@catladder/pipeline");
|
|
48
|
+
var zx_1 = require("zx");
|
|
49
|
+
var cluster_1 = require("../../../../../utils/cluster");
|
|
50
|
+
var gitlab_1 = require("../../../../../utils/gitlab");
|
|
51
|
+
var ensureNamespace_1 = __importDefault(require("../utils/ensureNamespace"));
|
|
52
|
+
var setupKubernetes = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var deployConfig, fullName, namespace, serviceAccountName, KUBE_URL, e_1, tokenName, KUBE_CA_PEM, KUBE_TOKEN, vars;
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
deployConfig = context.componentConfig.deploy;
|
|
58
|
+
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
59
|
+
throw new Error("cannot run setupKubernetes on non-kubernetes deployments");
|
|
60
|
+
}
|
|
61
|
+
fullName = (0, pipeline_1.getFullKubernetesClusterName)(deployConfig.cluster);
|
|
62
|
+
instance.log("cluster: ".concat(fullName));
|
|
63
|
+
return [4 /*yield*/, (0, cluster_1.connectToCluster)(fullName)];
|
|
64
|
+
case 1:
|
|
65
|
+
_a.sent();
|
|
66
|
+
instance.log("");
|
|
67
|
+
instance.log("ensuring namespace ...");
|
|
68
|
+
return [4 /*yield*/, (0, ensureNamespace_1["default"])(context)];
|
|
69
|
+
case 2:
|
|
70
|
+
namespace = _a.sent();
|
|
71
|
+
instance.log("Namespace " + namespace + " created / updated!");
|
|
72
|
+
instance.log("");
|
|
73
|
+
//$.verbose = true;
|
|
74
|
+
// we name the service account and the role and the role binding with the same name
|
|
75
|
+
// we currently create one per component to better separate them
|
|
76
|
+
instance.log("ensuring service accounts...");
|
|
77
|
+
serviceAccountName = "cl-".concat(context.componentName, "-deploy");
|
|
78
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'"], ["TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'"]))).then(function (s) { return s.stdout.trim(); })];
|
|
79
|
+
case 3:
|
|
80
|
+
KUBE_URL = _a.sent();
|
|
81
|
+
_a.label = 4;
|
|
82
|
+
case 4:
|
|
83
|
+
_a.trys.push([4, 8, , 9]);
|
|
84
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["kubectl delete serviceaccount --namespace ", " ", ""], ["kubectl delete serviceaccount --namespace ", " ", ""])), namespace, serviceAccountName)];
|
|
85
|
+
case 5:
|
|
86
|
+
_a.sent();
|
|
87
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["kubectl delete rolebinding --namespace ", " ", ""], ["kubectl delete rolebinding --namespace ", " ", ""])), namespace, serviceAccountName)];
|
|
88
|
+
case 6:
|
|
89
|
+
_a.sent();
|
|
90
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["kubectl delete role --namespace ", " ", ""], ["kubectl delete role --namespace ", " ", ""])), namespace, serviceAccountName)];
|
|
91
|
+
case 7:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [3 /*break*/, 9];
|
|
94
|
+
case 8:
|
|
95
|
+
e_1 = _a.sent();
|
|
96
|
+
return [3 /*break*/, 9];
|
|
97
|
+
case 9: return [4 /*yield*/, (0, zx_1.$)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["kubectl create serviceaccount --namespace ", " ", ""], ["kubectl create serviceaccount --namespace ", " ", ""])), namespace, serviceAccountName)];
|
|
98
|
+
case 10:
|
|
99
|
+
_a.sent();
|
|
100
|
+
// upsert role in the ns
|
|
101
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["cat <<EOF | kubectl apply -f -\nkind: Role\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n namespace: ", "\n name: ", "\nrules:\n- apiGroups: [\"\", \"extensions\", \"apps\", \"networking.k8s.io\", \"batch\", \"autoscaling\"]\n resources: [\"deployments\", \"replicasets\", \"statefulsets\", \"pods\", \"secrets\", \"configmaps\", \"services\", \"ingresses\", \"serviceaccounts\", \"jobs\", \"cronjobs\", \"horizontalpodautoscalers\"]\n verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"] # You can also use [\"*\"]\n---\nkind: RoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n name: ", "\n namespace: ", "\nsubjects:\n - kind: ServiceAccount\n name: ", "\n namespace: ", "\nroleRef:\n kind: Role\n name: ", "\n apiGroup: rbac.authorization.k8s.io\nEOF\n"], ["cat <<EOF | kubectl apply -f -\nkind: Role\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n namespace: ", "\n name: ", "\nrules:\n- apiGroups: [\"\", \"extensions\", \"apps\", \"networking.k8s.io\", \"batch\", \"autoscaling\"]\n resources: [\"deployments\", \"replicasets\", \"statefulsets\", \"pods\", \"secrets\", \"configmaps\", \"services\", \"ingresses\", \"serviceaccounts\", \"jobs\", \"cronjobs\", \"horizontalpodautoscalers\"]\n verbs: [\"get\", \"list\", \"watch\", \"create\", \"update\", \"patch\", \"delete\"] # You can also use [\"*\"]\n---\nkind: RoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n name: ", "\n namespace: ", "\nsubjects:\n - kind: ServiceAccount\n name: ", "\n namespace: ", "\nroleRef:\n kind: Role\n name: ", "\n apiGroup: rbac.authorization.k8s.io\nEOF\n"])), namespace, serviceAccountName, serviceAccountName, namespace, serviceAccountName, namespace, serviceAccountName)];
|
|
102
|
+
case 11:
|
|
103
|
+
// upsert role in the ns
|
|
104
|
+
_a.sent();
|
|
105
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["kubectl get serviceaccount --namespace ", " ", " -o jsonpath='{.secrets[0].name}'"], ["kubectl get serviceaccount --namespace ", " ", " -o jsonpath='{.secrets[0].name}'"])), namespace, serviceAccountName)];
|
|
106
|
+
case 12:
|
|
107
|
+
tokenName = _a.sent();
|
|
108
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["kubectl get secret ", " --namespace ", " -o jsonpath=\"{['data']['ca\\.crt']}\""], ["kubectl get secret ", " --namespace ", " -o jsonpath=\"{['data']['ca\\\\.crt']}\""])), tokenName, namespace).then(function (c) { return c.stdout.trim(); })];
|
|
109
|
+
case 13:
|
|
110
|
+
KUBE_CA_PEM = _a.sent();
|
|
111
|
+
return [4 /*yield*/, (0, zx_1.$)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["kubectl get secret ", " --namespace ", " -o jsonpath=\"{['data']['token']}\" | base64 --decode"], ["kubectl get secret ", " --namespace ", " -o jsonpath=\"{['data']['token']}\" | base64 --decode"])), tokenName, namespace).then(function (c) { return c.stdout.trim(); })];
|
|
112
|
+
case 14:
|
|
113
|
+
KUBE_TOKEN = _a.sent();
|
|
114
|
+
vars = {
|
|
115
|
+
KUBE_TOKEN: KUBE_TOKEN,
|
|
116
|
+
KUBE_CA_PEM: KUBE_CA_PEM,
|
|
117
|
+
KUBE_URL: KUBE_URL
|
|
118
|
+
};
|
|
119
|
+
instance.log("service accounts created / updated!");
|
|
120
|
+
instance.log("");
|
|
121
|
+
instance.log("pusing secrets to gitlab...");
|
|
122
|
+
return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.environment.shortName, context.componentName)];
|
|
123
|
+
case 15:
|
|
124
|
+
_a.sent();
|
|
125
|
+
instance.log("done!");
|
|
126
|
+
return [2 /*return*/];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}); };
|
|
130
|
+
exports.setupKubernetes = setupKubernetes;
|
|
131
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
132
|
+
//# sourceMappingURL=setupKubernetes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupKubernetes.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/setup/setupKubernetes.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
47
|
+
exports.__esModule = true;
|
|
48
|
+
exports.allEnvsAndAllComponents = exports.envAndComponents = exports.allEnvs = void 0;
|
|
49
|
+
var pipeline_1 = require("@catladder/pipeline");
|
|
50
|
+
var getProjectConfig_1 = require("../../../../../config/getProjectConfig");
|
|
51
|
+
var allEnvs = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var config;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
56
|
+
case 1:
|
|
57
|
+
config = _a.sent();
|
|
58
|
+
if (!config) {
|
|
59
|
+
return [2 /*return*/, []];
|
|
60
|
+
}
|
|
61
|
+
return [2 /*return*/, (0, pipeline_1.getAllEnvsInAllComponents)(config)];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}); };
|
|
65
|
+
exports.allEnvs = allEnvs;
|
|
66
|
+
var envAndComponents = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var allEnvAndcomponents;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getAllComponentsWithAllEnvsFlat)()];
|
|
71
|
+
case 1:
|
|
72
|
+
allEnvAndcomponents = _a.sent();
|
|
73
|
+
return [2 /*return*/, allEnvAndcomponents.reduce(function (acc, _a) {
|
|
74
|
+
var env = _a.env, componentName = _a.componentName;
|
|
75
|
+
return __spreadArray(__spreadArray([], acc, true), [env + ":" + componentName], false);
|
|
76
|
+
}, [])];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}); };
|
|
80
|
+
exports.envAndComponents = envAndComponents;
|
|
81
|
+
var allEnvsAndAllComponents = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return __generator(this, function (_c) {
|
|
84
|
+
switch (_c.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
_a = [[]];
|
|
87
|
+
return [4 /*yield*/, (0, exports.allEnvs)()];
|
|
88
|
+
case 1:
|
|
89
|
+
_b = [__spreadArray.apply(void 0, _a.concat([(_c.sent()), true]))];
|
|
90
|
+
return [4 /*yield*/, (0, exports.envAndComponents)()];
|
|
91
|
+
case 2: return [2 /*return*/, __spreadArray.apply(void 0, _b.concat([(_c.sent()), true]))];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); };
|
|
95
|
+
exports.allEnvsAndAllComponents = allEnvsAndAllComponents;
|
|
96
|
+
//# sourceMappingURL=autocompletions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocompletions.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/utils/autocompletions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA4E;AAC5E,2EAGgD;AAEzC,IAAM,OAAO,GAAG;;;;oBACN,qBAAM,IAAA,mCAAgB,GAAE,EAAA;;gBAAjC,MAAM,GAAG,SAAwB;gBACvC,IAAI,CAAC,MAAM,EAAE;oBACX,sBAAO,EAAE,EAAC;iBACX;gBACD,sBAAO,IAAA,oCAAyB,EAAC,MAAM,CAAC,EAAC;;;KAC1C,CAAC;AANW,QAAA,OAAO,WAMlB;AAEK,IAAM,gBAAgB,GAAG;;;;oBACF,qBAAM,IAAA,kDAA+B,GAAE,EAAA;;gBAA7D,mBAAmB,GAAG,SAAuC;gBAEnE,sBAAO,mBAAmB,CAAC,MAAM,CAC/B,UAAC,GAAG,EAAE,EAAsB;4BAApB,GAAG,SAAA,EAAE,aAAa,mBAAA;wBAAO,uCAAI,GAAG,UAAE,GAAG,GAAG,GAAG,GAAG,aAAa;oBAAlC,CAAmC,EACpE,EAAE,CACH,EAAC;;;KACH,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEK,IAAM,uBAAuB,GAAG;;;;;;gBACzB,qBAAM,IAAA,eAAO,GAAE,EAAA;;6DAAhB,CAAC,SAAe,CAAC;gBAAM,qBAAM,IAAA,wBAAgB,GAAE,EAAA;oBAA1D,6DAAiC,CAAC,SAAwB,CAAC,WAAE;;;KAC9D,CAAC;AAFW,QAAA,uBAAuB,2BAElC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (envComponent: string): Promise<void>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
var pipeline_1 = require("@catladder/pipeline");
|
|
40
|
+
var getProjectConfig_1 = require("../../../../../config/getProjectConfig");
|
|
41
|
+
var cluster_1 = require("../../../../../utils/cluster");
|
|
42
|
+
function default_1(envComponent) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
44
|
+
var _a, env, componentName, context, cluster, connectedClusterName, shouldContinue;
|
|
45
|
+
return __generator(this, function (_b) {
|
|
46
|
+
switch (_b.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
_a = (0, getProjectConfig_1.parseChoice)(envComponent), env = _a.env, componentName = _a.componentName;
|
|
49
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
|
|
50
|
+
case 1:
|
|
51
|
+
context = _b.sent();
|
|
52
|
+
if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
|
|
53
|
+
throw new Error("can't ensure cluster for non-kubernetes deployments");
|
|
54
|
+
}
|
|
55
|
+
cluster = (0, pipeline_1.getFullKubernetesClusterName)(context.componentConfig.deploy.cluster);
|
|
56
|
+
return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
|
|
57
|
+
case 2:
|
|
58
|
+
connectedClusterName = _b.sent();
|
|
59
|
+
if (!(cluster !== connectedClusterName)) return [3 /*break*/, 6];
|
|
60
|
+
this.log("you are currently connected to cluster '".concat(connectedClusterName, "'"));
|
|
61
|
+
this.log("but the project requires cluster '".concat(cluster, "'"));
|
|
62
|
+
return [4 /*yield*/, this.prompt({
|
|
63
|
+
type: "confirm",
|
|
64
|
+
name: "shouldContinue",
|
|
65
|
+
"default": true,
|
|
66
|
+
message: "Do you want to connect to '".concat(cluster, "'?")
|
|
67
|
+
})];
|
|
68
|
+
case 3:
|
|
69
|
+
shouldContinue = (_b.sent()).shouldContinue;
|
|
70
|
+
if (!!shouldContinue) return [3 /*break*/, 4];
|
|
71
|
+
this.log("abort");
|
|
72
|
+
return [3 /*break*/, 6];
|
|
73
|
+
case 4: return [4 /*yield*/, (0, cluster_1.connectToCluster)(cluster)];
|
|
74
|
+
case 5:
|
|
75
|
+
_b.sent();
|
|
76
|
+
this.log("connected to cluster '".concat(cluster, "'"));
|
|
77
|
+
_b.label = 6;
|
|
78
|
+
case 6: return [2 /*return*/];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports["default"] = default_1;
|
|
84
|
+
//# sourceMappingURL=ensureCluster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureCluster.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/utils/ensureCluster.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAG6B;AAC7B,2EAGgD;AAChD,wDAGsC;AACtC,mBAA+B,YAAoB;;;;;;oBAC3C,KAAyB,IAAA,8BAAW,EAAC,YAAY,CAAC,EAAhD,GAAG,SAAA,EAAE,aAAa,mBAAA,CAA+B;oBACzC,qBAAM,IAAA,6CAA0B,EAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;oBAA9D,OAAO,GAAG,SAAoD;oBACpE,IAAI,CAAC,IAAA,yBAAc,EAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE;wBACjE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;qBACxE;oBACK,OAAO,GAAG,IAAA,uCAA4B,EAC1C,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CACvC,CAAC;oBAC2B,qBAAM,IAAA,wCAA8B,GAAE,EAAA;;oBAA7D,oBAAoB,GAAG,SAAsC;yBAE/D,CAAA,OAAO,KAAK,oBAAoB,CAAA,EAAhC,wBAAgC;oBAClC,IAAI,CAAC,GAAG,CACN,kDAA2C,oBAAoB,MAAG,CACnE,CAAC;oBACF,IAAI,CAAC,GAAG,CAAC,4CAAqC,OAAO,MAAG,CAAC,CAAC;oBAC/B,qBAAM,IAAI,CAAC,MAAM,CAAC;4BAC3C,IAAI,EAAE,SAAS;4BACf,IAAI,EAAE,gBAAgB;4BACtB,SAAO,EAAE,IAAI;4BACb,OAAO,EAAE,qCAA8B,OAAO,OAAI;yBACnD,CAAC,EAAA;;oBALM,cAAc,GAAK,CAAA,SAKzB,CAAA,eALoB;yBAMlB,CAAC,cAAc,EAAf,wBAAe;oBACjB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;;wBAElB,qBAAM,IAAA,0BAAgB,EAAC,OAAO,CAAC,EAAA;;oBAA/B,SAA+B,CAAC;oBAChC,IAAI,CAAC,GAAG,CAAC,gCAAyB,OAAO,MAAG,CAAC,CAAC;;;;;;CAGnD;AA7BD,+BA6BC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.__esModule = true;
|
|
50
|
+
var pipeline_1 = require("@catladder/pipeline");
|
|
51
|
+
var client_node_1 = require("@kubernetes/client-node");
|
|
52
|
+
var k8sApi_1 = require("../../../../../k8sApi");
|
|
53
|
+
function default_1(context) {
|
|
54
|
+
var _a, _b, _c, _d, _e;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var namespace, namespaceBody, metadata, k8sApi, e_1;
|
|
57
|
+
return __generator(this, function (_f) {
|
|
58
|
+
switch (_f.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
namespace = (0, pipeline_1.getKubernetesNamespace)(context.fullConfig, context.environment.shortName);
|
|
61
|
+
namespaceBody = new client_node_1.V1Namespace();
|
|
62
|
+
metadata = {
|
|
63
|
+
name: namespace,
|
|
64
|
+
labels: __assign(__assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.environment.shortName, components: Object.keys(context.fullConfig.components).join("_"), buildTypes: Object.values(context.fullConfig.components)
|
|
65
|
+
.map(function (config) { return config.build.type; })
|
|
66
|
+
.join("_") }, Object.fromEntries(Object.entries(context.fullConfig.components).map(function (_a) {
|
|
67
|
+
var componentName = _a[0], config = _a[1];
|
|
68
|
+
return [
|
|
69
|
+
"buildType_" + componentName,
|
|
70
|
+
config.build.type,
|
|
71
|
+
];
|
|
72
|
+
}))), ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {}))
|
|
73
|
+
};
|
|
74
|
+
namespaceBody.metadata = metadata;
|
|
75
|
+
k8sApi = (0, k8sApi_1.getk8sApi)();
|
|
76
|
+
_f.label = 1;
|
|
77
|
+
case 1:
|
|
78
|
+
_f.trys.push([1, 4, , 8]);
|
|
79
|
+
return [4 /*yield*/, k8sApi.readNamespace(namespace)];
|
|
80
|
+
case 2:
|
|
81
|
+
_f.sent();
|
|
82
|
+
return [4 /*yield*/, k8sApi.patchNamespace(namespace, namespaceBody, undefined, undefined, undefined, undefined, { headers: { "content-type": "application/merge-patch+json" } } // see https://github.com/kubernetes-client/javascript/issues/443
|
|
83
|
+
)];
|
|
84
|
+
case 3:
|
|
85
|
+
_f.sent(); // update meta data
|
|
86
|
+
return [3 /*break*/, 8];
|
|
87
|
+
case 4:
|
|
88
|
+
e_1 = _f.sent();
|
|
89
|
+
if (!(((_d = (_c = e_1.response) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.reason) === "NotFound")) return [3 /*break*/, 6];
|
|
90
|
+
return [4 /*yield*/, k8sApi.createNamespace(namespaceBody)];
|
|
91
|
+
case 5:
|
|
92
|
+
_f.sent();
|
|
93
|
+
return [3 /*break*/, 7];
|
|
94
|
+
case 6:
|
|
95
|
+
console.error((_e = e_1.response) === null || _e === void 0 ? void 0 : _e.body);
|
|
96
|
+
throw e_1;
|
|
97
|
+
case 7: return [3 /*break*/, 8];
|
|
98
|
+
case 8: return [2 /*return*/, namespace];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
exports["default"] = default_1;
|
|
104
|
+
//# sourceMappingURL=ensureNamespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureNamespace.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/utils/ensureNamespace.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsE;AACtE,uDAAoE;AACpE,gDAAkD;AAElD,mBAA+B,OAAgB;;;;;;;oBACvC,SAAS,GAAG,IAAA,iCAAsB,EACtC,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,WAAW,CAAC,SAAS,CAC9B,CAAC;oBACI,aAAa,GAAG,IAAI,yBAAW,EAAE,CAAC;oBAClC,QAAQ,GAAiB;wBAC7B,IAAI,EAAE,SAAS;wBACf,MAAM,sBACJ,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,EAC7C,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,EACnC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,EAC1C,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAChE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC;iCACrD,GAAG,CAAC,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,KAAK,CAAC,IAAI,EAAjB,CAAiB,CAAC;iCAClC,IAAI,CAAC,GAAG,CAAC,IACT,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,CAC/C,UAAC,EAAuB;gCAAtB,aAAa,QAAA,EAAE,MAAM,QAAA;4BAAM,OAAA;gCAC3B,YAAY,GAAG,aAAa;gCAC5B,MAAM,CAAC,KAAK,CAAC,IAAI;6BAClB;wBAH4B,CAG5B,CACF,CACF,GACE,CAAC,MAAA,MAAA,OAAO,CAAC,UAAU,CAAC,IAAI,0CAAE,MAAM,mCAAI,EAAE,CAAC,CAC3C;qBACF,CAAC;oBAEF,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBAC5B,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;;;;oBAEzB,qBAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBAEtC,qBAAM,MAAM,CAAC,cAAc,CACzB,SAAS,EACT,aAAa,EACb,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,8BAA8B,EAAE,EAAE,CAAC,iEAAiE;yBAClI,EAAA;;oBARD,SAQC,CAAC,CAAC,mBAAmB;;;;yBAElB,CAAA,CAAA,MAAA,MAAA,GAAC,CAAC,QAAQ,0CAAE,IAAI,0CAAE,MAAM,MAAK,UAAU,CAAA,EAAvC,wBAAuC;oBACzC,qBAAM,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,EAAA;;oBAA3C,SAA2C,CAAC;;;oBAE5C,OAAO,CAAC,KAAK,CAAC,MAAA,GAAC,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;oBAChC,MAAM,GAAC,CAAC;;wBAGZ,sBAAO,SAAS,EAAC;;;;CAClB;AAnDD,+BAmDC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
exports.showProjectBanner = void 0;
|
|
40
|
+
var getProjectConfig_1 = require("../../../../../config/getProjectConfig");
|
|
41
|
+
var showProjectBanner = function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var projectConfig;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
46
|
+
case 1:
|
|
47
|
+
projectConfig = _a.sent();
|
|
48
|
+
if (projectConfig) {
|
|
49
|
+
vorpal.log("project: " + projectConfig.appName);
|
|
50
|
+
vorpal.log("customer: " + projectConfig.customerName);
|
|
51
|
+
vorpal.log("");
|
|
52
|
+
}
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}); };
|
|
57
|
+
exports.showProjectBanner = showProjectBanner;
|
|
58
|
+
//# sourceMappingURL=showProjectBanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showProjectBanner.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/utils/showProjectBanner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2EAA0E;AAEnE,IAAM,iBAAiB,GAAG,UAAO,MAAc;;;;oBAC9B,qBAAM,IAAA,mCAAgB,GAAE,EAAA;;gBAAxC,aAAa,GAAG,SAAwB;gBAC9C,IAAI,aAAa,EAAE;oBACjB,MAAM,CAAC,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;oBAChD,MAAM,CAAC,GAAG,CAAC,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;oBACtD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;iBAChB;;;;KACF,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DeployConfigKubernetesCluster } from "@catladder/pipeline";
|
|
2
|
+
export declare const openGoogleCloudLogs: (cluster?: DeployConfigKubernetesCluster, namespace?: string, googleAuthUserNumber?: number) => Promise<void>;
|
|
3
|
+
export declare const openGoogleCloudKubernetesDashboard: (cluster: DeployConfigKubernetesCluster, namespace: string, googleAuthUserNumber?: number) => Promise<void>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
exports.openGoogleCloudKubernetesDashboard = exports.openGoogleCloudLogs = void 0;
|
|
43
|
+
var open_1 = __importDefault(require("open"));
|
|
44
|
+
var openGoogleCloudLogs = function (cluster, namespace, googleAuthUserNumber) {
|
|
45
|
+
if (googleAuthUserNumber === void 0) { googleAuthUserNumber = 0; }
|
|
46
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var resource, url;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
resource = "k8s_container/cluster_name/".concat(cluster.name).concat(namespace ? "/namespace_name/".concat(namespace) : "");
|
|
50
|
+
url = "https://console.cloud.google.com/logs/viewer?project=".concat(cluster.projectId).concat(resource ? "&resource=".concat(encodeURIComponent(resource)) : "", "&authuser=").concat(googleAuthUserNumber);
|
|
51
|
+
(0, open_1["default"])(url);
|
|
52
|
+
return [2 /*return*/];
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
exports.openGoogleCloudLogs = openGoogleCloudLogs;
|
|
57
|
+
var openGoogleCloudKubernetesDashboard = function (cluster, namespace, googleAuthUserNumber) {
|
|
58
|
+
if (googleAuthUserNumber === void 0) { googleAuthUserNumber = 0; }
|
|
59
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
var pageState, url;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
pageState = "(\"savedViews\":(\"c\":[\"gke/".concat(cluster.region, "/").concat(cluster.name, "\"],\"n\":[\"").concat(namespace, "\"],\"i\":\"4e42e0b9cd6147f8a4fba7516752ec48\"))");
|
|
63
|
+
url = "https://console.cloud.google.com/kubernetes/workload?authuser=".concat(googleAuthUserNumber, "&project=").concat(cluster.projectId, "&pageState=").concat(encodeURIComponent(pageState));
|
|
64
|
+
(0, open_1["default"])(url);
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
exports.openGoogleCloudKubernetesDashboard = openGoogleCloudKubernetesDashboard;
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAAwB;AAEjB,IAAM,mBAAmB,GAAG,UACjC,OAAuC,EACvC,SAAkB,EAClB,oBAAwB;IAAxB,qCAAA,EAAA,wBAAwB;;;;YAElB,QAAQ,GAAG,qCAA8B,OAAO,CAAC,IAAI,SACzD,SAAS,CAAC,CAAC,CAAC,0BAAmB,SAAS,CAAE,CAAC,CAAC,CAAC,EAAE,CAC/C,CAAC;YAEG,GAAG,GAAG,+DACV,OAAO,CAAC,SAAS,SAEjB,QAAQ,CAAC,CAAC,CAAC,oBAAa,kBAAkB,CAAC,QAAQ,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,uBAChD,oBAAoB,CAAE,CAAC;YACpC,IAAA,iBAAI,EAAC,GAAG,CAAC,CAAC;;;;CACX,CAAC;AAfW,QAAA,mBAAmB,uBAe9B;AAEK,IAAM,kCAAkC,GAAG,UAChD,OAAsC,EACtC,SAAiB,EACjB,oBAAwB;IAAxB,qCAAA,EAAA,wBAAwB;;;;YAMlB,SAAS,GAAG,wCAA4B,OAAO,CAAC,MAAM,cAAI,OAAO,CAAC,IAAI,0BAAY,SAAS,qDAA6C,CAAC;YACzI,GAAG,GAAG,wEAAiE,oBAAoB,sBAC/F,OAAO,CAAC,SAAS,wBACL,kBAAkB,CAAC,SAAS,CAAC,CAAE,CAAC;YAE9C,IAAA,iBAAI,EAAC,GAAG,CAAC,CAAC;;;;CACX,CAAC;AAfW,QAAA,kCAAkC,sCAe7C"}
|