@catladder/cli 0.0.0-node16-ddfae617 → 0.0.0-prettier-cbceeed9
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/bin/catenv +1 -1
- package/bin/catenv-dev +3 -0
- package/bin/catladder +1 -1
- package/bin/catladder-dev +3 -0
- package/dist/apps/catenv/catenv.d.ts +4 -1
- package/dist/apps/catenv/catenv.js +28 -20
- package/dist/apps/catenv/catenv.js.map +1 -1
- package/dist/apps/cli/cli.js +4 -2
- package/dist/apps/cli/cli.js.map +1 -1
- package/dist/apps/cli/commands/{project/commandCopyDB.d.ts → cloudSQL/commandRestoreDb.d.ts} +1 -1
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +192 -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 +1 -1
- package/dist/apps/cli/commands/general/index.js +11 -11
- package/dist/apps/cli/commands/general/index.js.map +1 -1
- package/dist/apps/cli/commands/general/portForward.d.ts +1 -1
- package/dist/apps/cli/commands/general/portForward.js +3 -3
- package/dist/apps/cli/commands/general/portForward.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/index.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +2 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +27 -11
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/utils/index.js +16 -4
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -1
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +109 -45
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +29 -51
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandDeletePods.js +2 -1
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -1
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -1
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetShell.js +2 -1
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
- package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandListPods.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandListPods.js +2 -2
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -1
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +1 -2
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -1
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +2 -2
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenDashboard.js +19 -20
- package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGit.js +2 -7
- package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafana.js +2 -2
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +4 -3
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenLogs.js +7 -20
- package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -1
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.js +98 -36
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -1
- 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 +1 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -1
- package/dist/apps/cli/commands/project/index.d.ts +1 -1
- package/dist/apps/cli/commands/project/index.js +2 -2
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/index.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/index.js +11 -7
- package/dist/apps/cli/commands/project/setup/index.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +5 -4
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- 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/setupCloudSQL.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupCloudSQL.js +56 -0
- package/dist/apps/cli/commands/project/setup/setupCloudSQL.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
- package/dist/apps/cli/commands/project/setup/setupContext.js +17 -3
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js +12 -16
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- 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/ensureNamespace.d.ts +1 -1
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -1
- package/dist/apps/cli/config/writeConfig.d.ts +2 -2
- package/dist/apps/cli/verify/index.d.ts +1 -1
- package/dist/apps/cli/verify/migration/fromv2.d.ts +1 -1
- package/dist/apps/cli/verify/migration/fromv2.js +2 -0
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +3 -3
- package/dist/apps/cli/verify/migration/migrateSecrets.js +4 -3
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -1
- package/dist/bundles/catenv/index.js +44895 -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 +358730 -0
- package/dist/bundles/cli/xdg-open +1066 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/catenv.js +3 -3
- package/dist/catenv.js.map +1 -1
- package/dist/cli.js +0 -7
- package/dist/cli.js.map +1 -1
- package/dist/config/constants.d.ts +0 -1
- package/dist/config/constants.js +1 -2
- package/dist/config/constants.js.map +1 -1
- package/dist/config/getProjectConfig.d.ts +4 -7
- package/dist/config/getProjectConfig.js +21 -9
- package/dist/config/getProjectConfig.js.map +1 -1
- 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/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/{apps/cli/commands/shared/index.js → gcloud/openDashboard.js} +23 -27
- 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/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/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/cluster.js +3 -8
- package/dist/utils/cluster.js.map +1 -1
- package/dist/utils/gitlab.d.ts +5 -3
- package/dist/utils/gitlab.js +165 -46
- package/dist/utils/gitlab.js.map +1 -1
- package/dist/utils/passwordstore/index.d.ts +0 -1
- package/dist/utils/passwordstore/index.js +1 -64
- package/dist/utils/passwordstore/index.js.map +1 -1
- package/dist/utils/portForwards.d.ts +12 -0
- package/dist/utils/{portForward.js → portForwards.js} +20 -16
- package/dist/utils/portForwards.js.map +1 -0
- package/dist/utils/projects/index.d.ts +0 -3
- package/dist/utils/projects/index.js +3 -53
- package/dist/utils/projects/index.js.map +1 -1
- package/package.json +24 -22
- package/scripts/bundle +4 -0
- package/src/apps/catenv/catenv.ts +15 -8
- package/src/apps/cli/cli.ts +3 -1
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +169 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/cli/commands/general/index.ts +11 -8
- package/src/apps/cli/commands/general/portForward.ts +4 -4
- package/src/apps/cli/commands/mongodb/index.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +3 -5
- package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +18 -3
- package/src/apps/cli/commands/mongodb/utils/index.ts +19 -11
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +110 -37
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +12 -31
- package/src/apps/cli/commands/project/commandDeletePods.ts +3 -5
- package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
- package/src/apps/cli/commands/project/commandEnvVars.ts +1 -1
- package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +2 -2
- package/src/apps/cli/commands/project/commandGetShell.ts +3 -5
- package/src/apps/cli/commands/project/commandGitlabCi.ts +2 -1
- package/src/apps/cli/commands/project/commandInitProject.old.ts +1 -1
- package/src/apps/cli/commands/project/commandListPods.ts +2 -2
- package/src/apps/cli/commands/project/commandMigrateHelm3.ts +4 -3
- package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +3 -3
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +12 -32
- package/src/apps/cli/commands/project/commandOpenEnv.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGit.ts +3 -3
- package/src/apps/cli/commands/project/commandOpenGrafana.ts +3 -3
- package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +5 -7
- package/src/apps/cli/commands/project/commandOpenLogs.ts +4 -35
- package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
- package/src/apps/cli/commands/project/commandPortForward.ts +75 -34
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
- package/src/apps/cli/commands/project/commandSetup.ts +1 -1
- package/src/apps/cli/commands/project/commandTriggerCronjob.ts +3 -2
- package/src/apps/cli/commands/project/index.ts +4 -3
- package/src/apps/cli/commands/project/setup/index.ts +3 -1
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +23 -11
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupCloudSQL.ts +22 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +12 -2
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +34 -27
- package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +4 -2
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +1 -1
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +2 -2
- package/src/apps/cli/config/writeConfig.ts +2 -2
- package/src/apps/cli/verify/index.ts +1 -1
- package/src/apps/cli/verify/migration/fromv2.ts +5 -7
- package/src/apps/cli/verify/migration/migrateSecrets.ts +9 -4
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +2 -2
- package/src/catenv.ts +6 -3
- package/src/cli.ts +1 -7
- package/src/config/constants.ts +0 -2
- package/src/config/getProjectConfig.ts +14 -12
- 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/enableServices.ts +14 -0
- package/src/gcloud/openDashboard.ts +19 -0
- package/src/gcloud/serviceAccounts.ts +101 -0
- 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 +36 -1
- package/src/utils/cluster.ts +3 -3
- package/src/utils/gitlab.ts +137 -26
- package/src/utils/passwordstore/index.ts +2 -30
- package/src/utils/{portForward.ts → portForwards.ts} +27 -22
- package/src/utils/projects/index.ts +3 -24
- package/dist/apps/cli/commands/project/commandCopyDB.js +0 -102
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +0 -1
- package/dist/apps/cli/commands/shared/index.d.ts +0 -3
- package/dist/apps/cli/commands/shared/index.js.map +0 -1
- package/dist/utils/portForward.d.ts +0 -4
- package/dist/utils/portForward.js.map +0 -1
- package/src/apps/cli/commands/project/commandCopyDB.ts +0 -91
- package/src/apps/cli/commands/shared/index.ts +0 -36
|
@@ -0,0 +1,144 @@
|
|
|
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.upsertGcloudServiceAccountAndSaveSecret = exports.accountExists = void 0;
|
|
40
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
41
|
+
var crypto_1 = require("crypto");
|
|
42
|
+
var gitlab_1 = require("../utils/gitlab");
|
|
43
|
+
var accountExists = function (fullIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var _a;
|
|
45
|
+
return __generator(this, function (_b) {
|
|
46
|
+
switch (_b.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
_b.trys.push([0, 2, , 3]);
|
|
49
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud iam service-accounts describe ".concat(fullIdentifier))];
|
|
50
|
+
case 1:
|
|
51
|
+
_b.sent();
|
|
52
|
+
return [2 /*return*/, true];
|
|
53
|
+
case 2:
|
|
54
|
+
_a = _b.sent();
|
|
55
|
+
return [2 /*return*/, false];
|
|
56
|
+
case 3: return [2 /*return*/];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); };
|
|
60
|
+
exports.accountExists = accountExists;
|
|
61
|
+
var upsertGcloudServiceAccount = function (context, account) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62
|
+
var projectId, name, displayName, roles, description, namePrefix, nameSuffix, nameMiddleLength, nameMiddle, middle, fullName, fullDisplayName, fullIdentifier, existing, memberName, _i, roles_1, role, keys, _a, keys_1, key;
|
|
63
|
+
return __generator(this, function (_b) {
|
|
64
|
+
switch (_b.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
projectId = account.projectId, name = account.name, displayName = account.displayName, roles = account.roles, description = account.description;
|
|
67
|
+
namePrefix = "".concat(name, "-");
|
|
68
|
+
nameSuffix = "-".concat(context.environment.shortName, "-").concat(context.componentName);
|
|
69
|
+
nameMiddleLength = 30 - namePrefix.length - nameSuffix.length;
|
|
70
|
+
nameMiddle = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
71
|
+
middle = hashIfNessecary(nameMiddle, nameMiddleLength);
|
|
72
|
+
fullName = "".concat(namePrefix).concat(middle).concat(nameSuffix);
|
|
73
|
+
fullDisplayName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, " ").concat(context.environment.shortName, ":").concat(context.componentName, " | ").concat(displayName);
|
|
74
|
+
fullIdentifier = "".concat(fullName, "@").concat(projectId, ".iam.gserviceaccount.com");
|
|
75
|
+
return [4 /*yield*/, (0, exports.accountExists)(fullIdentifier)];
|
|
76
|
+
case 1:
|
|
77
|
+
existing = _b.sent();
|
|
78
|
+
if (!!existing) return [3 /*break*/, 3];
|
|
79
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud iam service-accounts create ".concat(fullName, " --display-name=\"").concat(fullDisplayName, "\" --project=\"").concat(projectId, "\" --description=\"").concat(description, "\""))];
|
|
80
|
+
case 2:
|
|
81
|
+
_b.sent();
|
|
82
|
+
_b.label = 3;
|
|
83
|
+
case 3:
|
|
84
|
+
memberName = "serviceAccount:".concat(fullIdentifier);
|
|
85
|
+
_i = 0, roles_1 = roles;
|
|
86
|
+
_b.label = 4;
|
|
87
|
+
case 4:
|
|
88
|
+
if (!(_i < roles_1.length)) return [3 /*break*/, 7];
|
|
89
|
+
role = roles_1[_i];
|
|
90
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud projects add-iam-policy-binding ".concat(projectId, " --member=").concat(memberName, " --role=").concat(role, " "))];
|
|
91
|
+
case 5:
|
|
92
|
+
_b.sent();
|
|
93
|
+
_b.label = 6;
|
|
94
|
+
case 6:
|
|
95
|
+
_i++;
|
|
96
|
+
return [3 /*break*/, 4];
|
|
97
|
+
case 7: return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud iam service-accounts keys list --iam-account=".concat(fullIdentifier, " --managed-by=user --format=json")).then(function (o) { return JSON.parse(o.stdout); })];
|
|
98
|
+
case 8:
|
|
99
|
+
keys = _b.sent();
|
|
100
|
+
_a = 0, keys_1 = keys;
|
|
101
|
+
_b.label = 9;
|
|
102
|
+
case 9:
|
|
103
|
+
if (!(_a < keys_1.length)) return [3 /*break*/, 12];
|
|
104
|
+
key = keys_1[_a];
|
|
105
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud iam service-accounts keys delete ".concat(key.name, " --quiet --iam-account=").concat(fullIdentifier))];
|
|
106
|
+
case 10:
|
|
107
|
+
_b.sent();
|
|
108
|
+
_b.label = 11;
|
|
109
|
+
case 11:
|
|
110
|
+
_a++;
|
|
111
|
+
return [3 /*break*/, 9];
|
|
112
|
+
case 12: return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud iam service-accounts keys create /dev/stdout --iam-account=".concat(fullIdentifier)).then(function (o) { return o.stdout; })];
|
|
113
|
+
case 13: return [2 /*return*/, _b.sent()];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); };
|
|
117
|
+
var upsertGcloudServiceAccountAndSaveSecret = function (instance, context, account, secretName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
var key;
|
|
119
|
+
var _a;
|
|
120
|
+
return __generator(this, function (_b) {
|
|
121
|
+
switch (_b.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
instance.log("upserting service account " + account.name + "...");
|
|
124
|
+
return [4 /*yield*/, upsertGcloudServiceAccount(context, account)];
|
|
125
|
+
case 1:
|
|
126
|
+
key = _b.sent();
|
|
127
|
+
return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
|
|
128
|
+
_a[secretName] = key,
|
|
129
|
+
_a), context.environment.shortName, context.componentName)];
|
|
130
|
+
case 2:
|
|
131
|
+
_b.sent();
|
|
132
|
+
instance.log("done!");
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}); };
|
|
137
|
+
exports.upsertGcloudServiceAccountAndSaveSecret = upsertGcloudServiceAccountAndSaveSecret;
|
|
138
|
+
var hashIfNessecary = function (str, maxLength) {
|
|
139
|
+
return str.length > maxLength ? hash(str, maxLength) : str;
|
|
140
|
+
};
|
|
141
|
+
var hash = function (str, length) {
|
|
142
|
+
return (0, crypto_1.createHmac)("sha256", str).digest("hex").substring(0, length);
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=serviceAccounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceAccounts.js","sourceRoot":"","sources":["../../src/gcloud/serviceAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+DAA6C;AAC7C,iCAAoC;AAEpC,0CAAqD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CAAC,EAAA;;gBAAxD,GAAG,GAAG,SAAkD;gBAE9D,qBAAM,IAAA,2BAAkB,EACtB,QAAQ;wBAEN,GAAC,UAAU,IAAG,GAAG;6BAEnB,OAAO,CAAC,WAAW,CAAC,SAAS,EAC7B,OAAO,CAAC,aAAa,CACtB,EAAA;;gBAPD,SAOC,CAAC;gBACF,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;;;;KACvB,CAAC;AAlBW,QAAA,uCAAuC,2CAkBlD;AAEF,IAAM,eAAe,GAAG,UAAC,GAAW,EAAE,SAAiB;IACrD,OAAA,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG;AAAnD,CAAmD,CAAC;AAEtD,IAAM,IAAI,GAAG,UAAC,GAAW,EAAE,MAAc;IACvC,OAAO,IAAA,mBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACtE,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const getProjectPods: (envComponent: string) => Promise<import("@kubernetes/client-node").V1Pod[]>;
|
|
2
|
+
export declare const getProjectPvcs: (envComponent: string) => Promise<import("@kubernetes/client-node").V1PersistentVolumeClaim[]>;
|
|
3
|
+
export declare const getProjectPodNames: (envComponent: string) => Promise<string[]>;
|
|
@@ -0,0 +1,88 @@
|
|
|
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.getProjectPodNames = exports.getProjectPvcs = exports.getProjectPods = void 0;
|
|
40
|
+
var parseChoice_1 = require("../config/parseChoice");
|
|
41
|
+
var k8sApi_1 = require("../k8sApi");
|
|
42
|
+
var projects_1 = require("../utils/projects");
|
|
43
|
+
var getProjectPods = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var namespace, k8sApi, res, componentName;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0: return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
|
|
48
|
+
case 1:
|
|
49
|
+
namespace = _a.sent();
|
|
50
|
+
k8sApi = (0, k8sApi_1.getk8sApi)();
|
|
51
|
+
return [4 /*yield*/, k8sApi.listNamespacedPod(namespace)];
|
|
52
|
+
case 2:
|
|
53
|
+
res = _a.sent();
|
|
54
|
+
componentName = (0, parseChoice_1.parseChoice)(envComponent).componentName;
|
|
55
|
+
return [2 /*return*/, res.body.items.filter(function (item) { var _a, _b; return componentName ? (_b = (_a = item.metadata) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes(componentName + "-") : true; })];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); };
|
|
59
|
+
exports.getProjectPods = getProjectPods;
|
|
60
|
+
var getProjectPvcs = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
+
var namespace, k8sApi, res;
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0: return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
|
|
65
|
+
case 1:
|
|
66
|
+
namespace = _a.sent();
|
|
67
|
+
k8sApi = (0, k8sApi_1.getk8sApi)();
|
|
68
|
+
return [4 /*yield*/, k8sApi.listNamespacedPersistentVolumeClaim(namespace)];
|
|
69
|
+
case 2:
|
|
70
|
+
res = _a.sent();
|
|
71
|
+
return [2 /*return*/, res.body.items];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}); };
|
|
75
|
+
exports.getProjectPvcs = getProjectPvcs;
|
|
76
|
+
var getProjectPodNames = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var pods;
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0: return [4 /*yield*/, (0, exports.getProjectPods)(envComponent)];
|
|
81
|
+
case 1:
|
|
82
|
+
pods = _a.sent();
|
|
83
|
+
return [2 /*return*/, pods.map(function (n) { return n.metadata.name; })];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); };
|
|
87
|
+
exports.getProjectPodNames = getProjectPodNames;
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kubernetes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAoD;AACpD,oCAAsC;AACtC,8CAAwD;AAEjD,IAAM,cAAc,GAAG,UAAO,YAAoB;;;;oBACrC,qBAAM,IAAA,8BAAmB,EAAC,YAAY,CAAC,EAAA;;gBAAnD,SAAS,GAAG,SAAuC;gBACnD,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;gBACf,qBAAM,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAA;;gBAA/C,GAAG,GAAG,SAAyC;gBAE7C,aAAa,GAAK,IAAA,yBAAW,EAAC,YAAY,CAAC,cAA9B,CAA+B;gBACpD,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,gBAChC,OAAA,aAAa,CAAC,CAAC,CAAC,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,0CAAE,QAAQ,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,EAAA,CAC1E,EAAC;;;KACH,CAAC;AATW,QAAA,cAAc,kBASzB;AAEK,IAAM,cAAc,GAAG,UAAO,YAAoB;;;;oBACrC,qBAAM,IAAA,8BAAmB,EAAC,YAAY,CAAC,EAAA;;gBAAnD,SAAS,GAAG,SAAuC;gBACnD,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;gBACf,qBAAM,MAAM,CAAC,mCAAmC,CAAC,SAAS,CAAC,EAAA;;gBAAjE,GAAG,GAAG,SAA2D;gBAEvE,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAC;;;KACvB,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,IAAM,kBAAkB,GAAG,UAAO,YAAoB;;;;oBAC9C,qBAAM,IAAA,sBAAc,EAAC,YAAY,CAAC,EAAA;;gBAAzC,IAAI,GAAG,SAAkC;gBAC/C,sBAAO,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAf,CAAe,CAAC,EAAC;;;KACzC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Context } from "@catladder/pipeline";
|
|
2
|
+
import type { CommandInstance } from "vorpal";
|
|
3
|
+
export declare const openGoogleCloudLogs: (instance: CommandInstance, context: Context) => Promise<void>;
|
|
4
|
+
export declare const openGoogleCloudKubernetesDashboard: (instance: CommandInstance, context: Context) => Promise<void>;
|
|
@@ -0,0 +1,94 @@
|
|
|
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.openGoogleCloudKubernetesDashboard = exports.openGoogleCloudLogs = void 0;
|
|
40
|
+
var pipeline_1 = require("@catladder/pipeline");
|
|
41
|
+
var openDashboard_1 = require("../gcloud/openDashboard");
|
|
42
|
+
var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var deployConfig, namespace, cluster, resource;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
deployConfig = context.componentConfig.deploy;
|
|
48
|
+
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
49
|
+
throw new Error("context is not of type kubernetes");
|
|
50
|
+
}
|
|
51
|
+
if (!deployConfig.cluster || deployConfig.cluster.type !== "gcloud") {
|
|
52
|
+
throw new Error("no gcloud custer configured");
|
|
53
|
+
}
|
|
54
|
+
namespace = context.environment.envVars.KUBE_NAMESPACE;
|
|
55
|
+
cluster = deployConfig.cluster;
|
|
56
|
+
resource = "k8s_container/cluster_name/".concat(cluster.name).concat(namespace ? "/namespace_name/".concat(namespace) : "");
|
|
57
|
+
return [4 /*yield*/, (0, openDashboard_1.openGoogleCloudDashboard)(instance, "logs/viewer", {
|
|
58
|
+
project: cluster.projectId,
|
|
59
|
+
resource: resource
|
|
60
|
+
})];
|
|
61
|
+
case 1:
|
|
62
|
+
_a.sent();
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); };
|
|
67
|
+
exports.openGoogleCloudLogs = openGoogleCloudLogs;
|
|
68
|
+
var openGoogleCloudKubernetesDashboard = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var deployConfig, namespace, cluster, pageState;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
deployConfig = context.componentConfig.deploy;
|
|
74
|
+
if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
75
|
+
throw new Error("context is not of type kubernetes");
|
|
76
|
+
}
|
|
77
|
+
if (!deployConfig.cluster || deployConfig.cluster.type !== "gcloud") {
|
|
78
|
+
throw new Error("no gcloud custer configured");
|
|
79
|
+
}
|
|
80
|
+
namespace = context.environment.envVars.KUBE_NAMESPACE;
|
|
81
|
+
cluster = deployConfig.cluster;
|
|
82
|
+
pageState = "(\"savedViews\":(\"c\":[\"gke/".concat(cluster.region, "/").concat(cluster.name, "\"],\"n\":[\"").concat(namespace, "\"],\"i\":\"4e42e0b9cd6147f8a4fba7516752ec48\"))");
|
|
83
|
+
return [4 /*yield*/, (0, openDashboard_1.openGoogleCloudDashboard)(instance, "kubernetes/workload", {
|
|
84
|
+
project: cluster.projectId,
|
|
85
|
+
pageState: pageState
|
|
86
|
+
})];
|
|
87
|
+
case 1:
|
|
88
|
+
_a.sent();
|
|
89
|
+
return [2 /*return*/];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}); };
|
|
93
|
+
exports.openGoogleCloudKubernetesDashboard = openGoogleCloudKubernetesDashboard;
|
|
94
|
+
//# sourceMappingURL=openKubernetesDashboards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openKubernetesDashboards.js","sourceRoot":"","sources":["../../src/kubernetes/openKubernetesDashboards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAC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AAK,CAAC,6BAA6B,CAAC,CAAC;iBAChD;gBACK,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC;gBACvD,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;gBAC/B,SAAS,GAAG,wCAA4B,OAAO,CAAC,MAAM,cAAI,OAAO,CAAC,IAAI,0BAAY,SAAS,qDAA6C,CAAC;gBAE/I,qBAAM,IAAA,wCAAwB,EAAC,QAAQ,EAAE,qBAAqB,EAAE;wBAC9D,OAAO,EAAE,OAAO,CAAC,SAAS;wBAC1B,SAAS,EAAE,SAAS;qBACrB,CAAC,EAAA;;gBAHF,SAGE,CAAC;;;;KACJ,CAAC;AApBW,QAAA,kCAAkC,sCAoB7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const startKubePortForward: (podname: string, localPort: number, remotePort: number, namespace: string) => Promise<void>;
|
|
@@ -0,0 +1,55 @@
|
|
|
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.startKubePortForward = void 0;
|
|
40
|
+
var portForwards_1 = require("../utils/portForwards");
|
|
41
|
+
var startKubePortForward = function (podname, localPort, remotePort, namespace) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var name;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
name = "kube/".concat(namespace, "/").concat(podname, "/").concat(localPort, ":").concat(remotePort);
|
|
47
|
+
return [4 /*yield*/, (0, portForwards_1.startPortForwardCommand)(name, "kubectl port-forward ".concat(podname, " ").concat(localPort, ":").concat(remotePort, " -n ").concat(namespace))];
|
|
48
|
+
case 1:
|
|
49
|
+
_a.sent();
|
|
50
|
+
return [2 /*return*/];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}); };
|
|
54
|
+
exports.startKubePortForward = startKubePortForward;
|
|
55
|
+
//# sourceMappingURL=portForward.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portForward.js","sourceRoot":"","sources":["../../src/kubernetes/portForward.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAgE;AAEzD,IAAM,oBAAoB,GAAG,UAClC,OAAe,EACf,SAAiB,EACjB,UAAkB,EAClB,SAAiB;;;;;gBAEX,IAAI,GAAG,eAAQ,SAAS,cAAI,OAAO,cAAI,SAAS,cAAI,UAAU,CAAE,CAAC;gBAEvE,qBAAM,IAAA,sCAAuB,EAC3B,IAAI,EACJ,+BAAwB,OAAO,cAAI,SAAS,cAAI,UAAU,iBAAO,SAAS,CAAE,CAC7E,EAAA;;gBAHD,SAGC,CAAC;;;;KACH,CAAC;AAZW,QAAA,oBAAoB,wBAY/B"}
|