@catladder/cli 0.0.0-main-ef309945 → 0.0.0-main-79f19757
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/dist/apps/cli/cli.js +2 -2
- package/dist/apps/cli/cli.js.map +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.js +3 -3
- package/dist/apps/cli/commands/general/portForward.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +2 -2
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +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/commandOpenGrafana.js +2 -2
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +2 -2
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.js +97 -36
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -1
- package/dist/bundles/catenv/index.js +4 -4
- package/dist/bundles/cli/index.js +208 -81
- 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/portForwards.d.ts +12 -0
- package/dist/utils/{portForward.js → portForwards.js} +20 -16
- package/dist/utils/portForwards.js.map +1 -0
- package/package.json +2 -2
- package/src/apps/cli/cli.ts +1 -1
- package/src/apps/cli/commands/general/index.ts +10 -7
- package/src/apps/cli/commands/general/portForward.ts +3 -3
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +2 -2
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +2 -2
- package/src/apps/cli/commands/project/commandOpenGrafana.ts +2 -2
- package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +2 -2
- package/src/apps/cli/commands/project/commandPortForward.ts +72 -29
- package/src/kubernetes/portForward.ts +15 -0
- package/src/utils/{portForward.ts → portForwards.ts} +27 -22
- package/dist/utils/portForward.d.ts +0 -4
- package/dist/utils/portForward.js.map +0 -1
|
@@ -49,7 +49,7 @@ exports.__esModule = true;
|
|
|
49
49
|
var vorpal_1 = __importDefault(__nccwpck_require__(71491));
|
|
50
50
|
// tslint:disable-next-line:no-var-requires
|
|
51
51
|
var packageInfos_1 = __importDefault(__nccwpck_require__(71628));
|
|
52
|
-
var
|
|
52
|
+
var portForwards_1 = __nccwpck_require__(15237);
|
|
53
53
|
var general_1 = __importDefault(__nccwpck_require__(3605));
|
|
54
54
|
var mongodb_1 = __importDefault(__nccwpck_require__(52934));
|
|
55
55
|
var cloudSQL_1 = __importDefault(__nccwpck_require__(6675));
|
|
@@ -81,7 +81,7 @@ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
81
81
|
(0, mongodb_1["default"])(vorpal);
|
|
82
82
|
(0, theStuffThatReallyMatters_1["default"])(vorpal);
|
|
83
83
|
process.on("exit", function () {
|
|
84
|
-
(0,
|
|
84
|
+
(0, portForwards_1.stopAllPortForwards)();
|
|
85
85
|
});
|
|
86
86
|
return [2 /*return*/];
|
|
87
87
|
}
|
|
@@ -398,10 +398,10 @@ var k8sApi_1 = __nccwpck_require__(54756);
|
|
|
398
398
|
var cluster_1 = __nccwpck_require__(66894);
|
|
399
399
|
var log_1 = __nccwpck_require__(37851);
|
|
400
400
|
var passwordstore_1 = __nccwpck_require__(37234);
|
|
401
|
-
var
|
|
401
|
+
var portForwards_1 = __nccwpck_require__(15237);
|
|
402
402
|
var shell_1 = __nccwpck_require__(60983);
|
|
403
403
|
var namespaceAutoCompletion_1 = __nccwpck_require__(79176);
|
|
404
|
-
var
|
|
404
|
+
var portForward_1 = __importDefault(__nccwpck_require__(75059));
|
|
405
405
|
var getAllNamespaces = (0, memoizee_1["default"])(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
406
406
|
var k8sApi, res;
|
|
407
407
|
return __generator(this, function (_a) {
|
|
@@ -429,7 +429,7 @@ var getAllNamespacesNames = function () { return __awaiter(void 0, void 0, void
|
|
|
429
429
|
exports.getAllNamespacesNames = getAllNamespacesNames;
|
|
430
430
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
431
431
|
return __generator(this, function (_a) {
|
|
432
|
-
vorpal.command("current-context").action(function () {
|
|
432
|
+
vorpal.command("kube-current-context").action(function () {
|
|
433
433
|
return __awaiter(this, void 0, void 0, function () {
|
|
434
434
|
var _a;
|
|
435
435
|
return __generator(this, function (_b) {
|
|
@@ -445,7 +445,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
445
445
|
});
|
|
446
446
|
});
|
|
447
447
|
vorpal
|
|
448
|
-
.command("list-namespaces", "list all namespaces")
|
|
448
|
+
.command("kube-list-namespaces", "list all namespaces")
|
|
449
449
|
.action(function () {
|
|
450
450
|
return __awaiter(this, void 0, void 0, function () {
|
|
451
451
|
var namespaces;
|
|
@@ -461,7 +461,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
461
461
|
});
|
|
462
462
|
});
|
|
463
463
|
vorpal
|
|
464
|
-
.command("list-secrets <namespace>", "show secrets")
|
|
464
|
+
.command("kube-list-secrets <namespace>", "show secrets")
|
|
465
465
|
.autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
|
|
466
466
|
.action(function (_a) {
|
|
467
467
|
var namespace = _a.namespace;
|
|
@@ -494,7 +494,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
494
494
|
});
|
|
495
495
|
});
|
|
496
496
|
vorpal
|
|
497
|
-
.command("list-pods <namespace>", "list all pods of namespace")
|
|
497
|
+
.command("kube-list-pods <namespace>", "list all pods of namespace")
|
|
498
498
|
.autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
|
|
499
499
|
.action(function (_a) {
|
|
500
500
|
var namespace = _a.namespace;
|
|
@@ -514,21 +514,21 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
514
514
|
});
|
|
515
515
|
});
|
|
516
516
|
vorpal
|
|
517
|
-
.command("stop-portforward <name>", "stop a running port forward")
|
|
517
|
+
.command("kube-stop-portforward <name>", "stop a running port forward")
|
|
518
518
|
.autocomplete({ data: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
519
|
-
return [2 /*return*/, (0,
|
|
519
|
+
return [2 /*return*/, (0, portForwards_1.getAllRunningPortForwards)()];
|
|
520
520
|
}); }); } })
|
|
521
521
|
.action(function (_a) {
|
|
522
522
|
var name = _a.name;
|
|
523
523
|
return __awaiter(this, void 0, void 0, function () {
|
|
524
524
|
return __generator(this, function (_b) {
|
|
525
|
-
(0,
|
|
525
|
+
(0, portForwards_1.stopPortForward)(name.trim());
|
|
526
526
|
return [2 /*return*/];
|
|
527
527
|
});
|
|
528
528
|
});
|
|
529
529
|
});
|
|
530
530
|
vorpal
|
|
531
|
-
.command("get-shell <namespace>", "get a shell to a pod in the environment")
|
|
531
|
+
.command("kube-get-shell <namespace>", "get a shell to a pod in the environment")
|
|
532
532
|
.autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
|
|
533
533
|
.action(function (_a) {
|
|
534
534
|
var namespace = _a.namespace;
|
|
@@ -562,7 +562,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
562
562
|
});
|
|
563
563
|
});
|
|
564
564
|
});
|
|
565
|
-
(0,
|
|
565
|
+
(0, portForward_1["default"])(vorpal);
|
|
566
566
|
return [2 /*return*/];
|
|
567
567
|
});
|
|
568
568
|
}); });
|
|
@@ -676,13 +676,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
676
676
|
};
|
|
677
677
|
exports.__esModule = true;
|
|
678
678
|
var log_1 = __nccwpck_require__(37851);
|
|
679
|
-
var portForward_1 = __nccwpck_require__(
|
|
679
|
+
var portForward_1 = __nccwpck_require__(20417);
|
|
680
680
|
var k8sApi_1 = __nccwpck_require__(54756);
|
|
681
681
|
var namespaceAutoCompletion_1 = __nccwpck_require__(79176);
|
|
682
682
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
683
683
|
return __generator(this, function (_a) {
|
|
684
684
|
return [2 /*return*/, vorpal
|
|
685
|
-
.command("port-forward <namespace>", "start port-forwarding")
|
|
685
|
+
.command("kube-port-forward <namespace>", "start port-forwarding")
|
|
686
686
|
.autocomplete(namespaceAutoCompletion_1.namespaceAutoCompletion)
|
|
687
687
|
.action(function (_a) {
|
|
688
688
|
var namespace = _a.namespace;
|
|
@@ -726,7 +726,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
726
726
|
})];
|
|
727
727
|
case 4:
|
|
728
728
|
remotePort = (_b.sent()).remotePort;
|
|
729
|
-
return [2 /*return*/, (0, portForward_1.
|
|
729
|
+
return [2 /*return*/, (0, portForward_1.startKubePortForward)(podName, localPort, remotePort, namespace)];
|
|
730
730
|
}
|
|
731
731
|
});
|
|
732
732
|
});
|
|
@@ -1145,7 +1145,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1145
1145
|
exports.__esModule = true;
|
|
1146
1146
|
var getProjectConfig_1 = __nccwpck_require__(24146);
|
|
1147
1147
|
var log_1 = __nccwpck_require__(37851);
|
|
1148
|
-
var portForward_1 = __nccwpck_require__(
|
|
1148
|
+
var portForward_1 = __nccwpck_require__(20417);
|
|
1149
1149
|
var projects_1 = __nccwpck_require__(41619);
|
|
1150
1150
|
var autocompletions_1 = __nccwpck_require__(41373);
|
|
1151
1151
|
var ensureCluster_1 = __importDefault(__nccwpck_require__(8722));
|
|
@@ -1214,7 +1214,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
1214
1214
|
this.log("");
|
|
1215
1215
|
this.log("👆 connection string has been copied to your clipboard!");
|
|
1216
1216
|
this.log("");
|
|
1217
|
-
return [2 /*return*/, (0, portForward_1.
|
|
1217
|
+
return [2 /*return*/, (0, portForward_1.startKubePortForward)(podName, localPort, 27017, namespace)];
|
|
1218
1218
|
}
|
|
1219
1219
|
});
|
|
1220
1220
|
});
|
|
@@ -2923,7 +2923,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2923
2923
|
exports.__esModule = true;
|
|
2924
2924
|
var open_1 = __importDefault(__nccwpck_require__(14247));
|
|
2925
2925
|
var constants_1 = __nccwpck_require__(3032);
|
|
2926
|
-
var portForward_1 = __nccwpck_require__(
|
|
2926
|
+
var portForward_1 = __nccwpck_require__(20417);
|
|
2927
2927
|
var projects_1 = __nccwpck_require__(41619);
|
|
2928
2928
|
var autocompletions_1 = __nccwpck_require__(41373);
|
|
2929
2929
|
var ensureCluster_1 = __importDefault(__nccwpck_require__(8722));
|
|
@@ -2950,7 +2950,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
2950
2950
|
case 2:
|
|
2951
2951
|
namespace = _b.sent();
|
|
2952
2952
|
url = "http://localhost:".concat(constants_1.GRAFANA_PROXY_LOCAL_PORT, "/namespace.html?name=").concat(namespace);
|
|
2953
|
-
return [4 /*yield*/, (0, portForward_1.
|
|
2953
|
+
return [4 /*yield*/, (0, portForward_1.startKubePortForward)("deployment/kubecost-cost-analyzer", constants_1.GRAFANA_PROXY_LOCAL_PORT, constants_1.GRAFANA_PROXY_TARGET_PORT, "kubecost")];
|
|
2954
2954
|
case 3:
|
|
2955
2955
|
_b.sent();
|
|
2956
2956
|
(0, open_1["default"])(url);
|
|
@@ -3253,7 +3253,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3253
3253
|
};
|
|
3254
3254
|
exports.__esModule = true;
|
|
3255
3255
|
var open_1 = __importDefault(__nccwpck_require__(14247));
|
|
3256
|
-
var portForward_1 = __nccwpck_require__(
|
|
3256
|
+
var portForward_1 = __nccwpck_require__(20417);
|
|
3257
3257
|
var constants_1 = __nccwpck_require__(3032);
|
|
3258
3258
|
var projects_1 = __nccwpck_require__(41619);
|
|
3259
3259
|
var autocompletions_1 = __nccwpck_require__(41373);
|
|
@@ -3281,7 +3281,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3281
3281
|
case 2:
|
|
3282
3282
|
namespace = _b.sent();
|
|
3283
3283
|
url = "http://localhost:".concat(constants_1.GRAFANA_PROXY_LOCAL_PORT, "/grafana/d/at-cost-analysis-namespace2/namespace-utilization-metrics?var-namespace=").concat(namespace);
|
|
3284
|
-
return [4 /*yield*/, (0, portForward_1.
|
|
3284
|
+
return [4 /*yield*/, (0, portForward_1.startKubePortForward)("deployment/kubecost-cost-analyzer", constants_1.GRAFANA_PROXY_LOCAL_PORT, constants_1.GRAFANA_PROXY_TARGET_PORT, "kubecost")];
|
|
3285
3285
|
case 3:
|
|
3286
3286
|
_b.sent();
|
|
3287
3287
|
(0, open_1["default"])(url);
|
|
@@ -3346,7 +3346,7 @@ var open_1 = __importDefault(__nccwpck_require__(14247));
|
|
|
3346
3346
|
var constants_1 = __nccwpck_require__(3032);
|
|
3347
3347
|
var kubernetes_1 = __nccwpck_require__(80606);
|
|
3348
3348
|
var log_1 = __nccwpck_require__(37851);
|
|
3349
|
-
var portForward_1 = __nccwpck_require__(
|
|
3349
|
+
var portForward_1 = __nccwpck_require__(20417);
|
|
3350
3350
|
var projects_1 = __nccwpck_require__(41619);
|
|
3351
3351
|
var autocompletions_1 = __nccwpck_require__(41373);
|
|
3352
3352
|
var ensureCluster_1 = __importDefault(__nccwpck_require__(8722));
|
|
@@ -3388,7 +3388,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3388
3388
|
case 4:
|
|
3389
3389
|
namespace = _b.sent();
|
|
3390
3390
|
url = "http://localhost:".concat(constants_1.GRAFANA_PROXY_LOCAL_PORT, "/grafana/d/at-cost-analysis-pod/pod-cost-and-utilization-metrics?var-namespace=").concat(namespace, "&var-pod=").concat(podName);
|
|
3391
|
-
return [4 /*yield*/, (0, portForward_1.
|
|
3391
|
+
return [4 /*yield*/, (0, portForward_1.startKubePortForward)("deployment/kubecost-cost-analyzer", constants_1.GRAFANA_PROXY_LOCAL_PORT, constants_1.GRAFANA_PROXY_TARGET_PORT, "kubecost")];
|
|
3392
3392
|
case 5:
|
|
3393
3393
|
_b.sent();
|
|
3394
3394
|
(0, open_1["default"])(url);
|
|
@@ -3636,10 +3636,90 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3636
3636
|
exports.__esModule = true;
|
|
3637
3637
|
var kubernetes_1 = __nccwpck_require__(80606);
|
|
3638
3638
|
var log_1 = __nccwpck_require__(37851);
|
|
3639
|
-
var portForward_1 = __nccwpck_require__(
|
|
3639
|
+
var portForward_1 = __nccwpck_require__(20417);
|
|
3640
3640
|
var projects_1 = __nccwpck_require__(41619);
|
|
3641
3641
|
var autocompletions_1 = __nccwpck_require__(41373);
|
|
3642
3642
|
var ensureCluster_1 = __importDefault(__nccwpck_require__(8722));
|
|
3643
|
+
var parseChoice_1 = __nccwpck_require__(3319);
|
|
3644
|
+
var getProjectConfig_1 = __nccwpck_require__(24146);
|
|
3645
|
+
var pipeline_1 = __nccwpck_require__(25355);
|
|
3646
|
+
var portForwards_1 = __nccwpck_require__(15237);
|
|
3647
|
+
var open_1 = __importDefault(__nccwpck_require__(14247));
|
|
3648
|
+
var kubePortForward = function (cmd, envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3649
|
+
var namespace, podNames, podName, localPort, remotePort;
|
|
3650
|
+
return __generator(this, function (_a) {
|
|
3651
|
+
switch (_a.label) {
|
|
3652
|
+
case 0: return [4 /*yield*/, ensureCluster_1["default"].call(cmd, envComponent)];
|
|
3653
|
+
case 1:
|
|
3654
|
+
_a.sent();
|
|
3655
|
+
return [4 /*yield*/, (0, projects_1.getProjectNamespace)(envComponent)];
|
|
3656
|
+
case 2:
|
|
3657
|
+
namespace = _a.sent();
|
|
3658
|
+
return [4 /*yield*/, (0, kubernetes_1.getProjectPodNames)(envComponent)];
|
|
3659
|
+
case 3:
|
|
3660
|
+
podNames = _a.sent();
|
|
3661
|
+
if (podNames.length === 0) {
|
|
3662
|
+
(0, log_1.logError)(cmd, "sorry, no pods found");
|
|
3663
|
+
return [2 /*return*/];
|
|
3664
|
+
}
|
|
3665
|
+
return [4 /*yield*/, cmd.prompt({
|
|
3666
|
+
type: "list",
|
|
3667
|
+
name: "podName",
|
|
3668
|
+
choices: podNames,
|
|
3669
|
+
message: "Which pod? 🤔"
|
|
3670
|
+
})];
|
|
3671
|
+
case 4:
|
|
3672
|
+
podName = (_a.sent()).podName;
|
|
3673
|
+
return [4 /*yield*/, cmd.prompt({
|
|
3674
|
+
type: "number",
|
|
3675
|
+
name: "localPort",
|
|
3676
|
+
message: "Local port: "
|
|
3677
|
+
})];
|
|
3678
|
+
case 5:
|
|
3679
|
+
localPort = (_a.sent()).localPort;
|
|
3680
|
+
return [4 /*yield*/, cmd.prompt({
|
|
3681
|
+
type: "number",
|
|
3682
|
+
name: "remotePort",
|
|
3683
|
+
message: "Remote port: "
|
|
3684
|
+
})];
|
|
3685
|
+
case 6:
|
|
3686
|
+
remotePort = (_a.sent()).remotePort;
|
|
3687
|
+
return [2 /*return*/, (0, portForward_1.startKubePortForward)(podName, localPort, remotePort, namespace)];
|
|
3688
|
+
}
|
|
3689
|
+
});
|
|
3690
|
+
}); };
|
|
3691
|
+
var cloudRunPortForward = function (cmd, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3692
|
+
var fullName, serviceName, mr, _a, projectId, region, command;
|
|
3693
|
+
return __generator(this, function (_b) {
|
|
3694
|
+
switch (_b.label) {
|
|
3695
|
+
case 0:
|
|
3696
|
+
if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) {
|
|
3697
|
+
throw new Error("not cloud run");
|
|
3698
|
+
}
|
|
3699
|
+
fullName = context.environment.fullName;
|
|
3700
|
+
serviceName = fullName;
|
|
3701
|
+
if (!(context.environment.envType === "review")) return [3 /*break*/, 2];
|
|
3702
|
+
return [4 /*yield*/, cmd.prompt({
|
|
3703
|
+
type: "number",
|
|
3704
|
+
name: "mr",
|
|
3705
|
+
message: "Which mr 🤔 "
|
|
3706
|
+
})];
|
|
3707
|
+
case 1:
|
|
3708
|
+
mr = (_b.sent()).mr;
|
|
3709
|
+
// poor mans solution
|
|
3710
|
+
serviceName = serviceName.replace("-review-", "-review-mr" + mr + "-");
|
|
3711
|
+
_b.label = 2;
|
|
3712
|
+
case 2:
|
|
3713
|
+
_a = context.componentConfig.deploy, projectId = _a.projectId, region = _a.region;
|
|
3714
|
+
command = "gcloud beta run services proxy ".concat(serviceName, " --project ").concat(projectId, " --region ").concat(region);
|
|
3715
|
+
return [4 /*yield*/, (0, portForwards_1.startPortForwardCommand)("cloudRun/".concat(serviceName), command)];
|
|
3716
|
+
case 3:
|
|
3717
|
+
_b.sent();
|
|
3718
|
+
(0, open_1["default"])("http://localhost:8080");
|
|
3719
|
+
return [2 /*return*/];
|
|
3720
|
+
}
|
|
3721
|
+
});
|
|
3722
|
+
}); };
|
|
3643
3723
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3644
3724
|
var _a, _b;
|
|
3645
3725
|
return __generator(this, function (_c) {
|
|
@@ -3653,45 +3733,26 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3653
3733
|
.action(function (_a) {
|
|
3654
3734
|
var envComponent = _a.envComponent;
|
|
3655
3735
|
return __awaiter(this, void 0, void 0, function () {
|
|
3656
|
-
var
|
|
3657
|
-
return __generator(this, function (
|
|
3658
|
-
switch (
|
|
3659
|
-
case 0:
|
|
3736
|
+
var _b, env, componentName, context;
|
|
3737
|
+
return __generator(this, function (_c) {
|
|
3738
|
+
switch (_c.label) {
|
|
3739
|
+
case 0:
|
|
3740
|
+
_b = (0, parseChoice_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
|
|
3741
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
|
|
3660
3742
|
case 1:
|
|
3661
|
-
|
|
3662
|
-
|
|
3743
|
+
context = _c.sent();
|
|
3744
|
+
if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
|
|
3745
|
+
return [4 /*yield*/, kubePortForward(this, envComponent)];
|
|
3663
3746
|
case 2:
|
|
3664
|
-
|
|
3665
|
-
|
|
3747
|
+
_c.sent();
|
|
3748
|
+
_c.label = 3;
|
|
3666
3749
|
case 3:
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
(0, log_1.logError)(this, "sorry, no pods found");
|
|
3670
|
-
return [2 /*return*/];
|
|
3671
|
-
}
|
|
3672
|
-
return [4 /*yield*/, this.prompt({
|
|
3673
|
-
type: "list",
|
|
3674
|
-
name: "podName",
|
|
3675
|
-
choices: podNames,
|
|
3676
|
-
message: "Which pod? 🤔"
|
|
3677
|
-
})];
|
|
3750
|
+
if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
|
|
3751
|
+
return [4 /*yield*/, cloudRunPortForward(this, context)];
|
|
3678
3752
|
case 4:
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
name: "localPort",
|
|
3683
|
-
message: "Local port: "
|
|
3684
|
-
})];
|
|
3685
|
-
case 5:
|
|
3686
|
-
localPort = (_b.sent()).localPort;
|
|
3687
|
-
return [4 /*yield*/, this.prompt({
|
|
3688
|
-
type: "number",
|
|
3689
|
-
name: "remotePort",
|
|
3690
|
-
message: "Remote port: "
|
|
3691
|
-
})];
|
|
3692
|
-
case 6:
|
|
3693
|
-
remotePort = (_b.sent()).remotePort;
|
|
3694
|
-
return [2 /*return*/, (0, portForward_1.startPortForward)(podName, localPort, remotePort, namespace)];
|
|
3753
|
+
_c.sent();
|
|
3754
|
+
_c.label = 5;
|
|
3755
|
+
case 5: return [2 /*return*/];
|
|
3695
3756
|
}
|
|
3696
3757
|
});
|
|
3697
3758
|
});
|
|
@@ -7082,6 +7143,68 @@ exports.openGoogleCloudKubernetesDashboard = openGoogleCloudKubernetesDashboard;
|
|
|
7082
7143
|
|
|
7083
7144
|
/***/ }),
|
|
7084
7145
|
|
|
7146
|
+
/***/ 20417:
|
|
7147
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
7148
|
+
|
|
7149
|
+
"use strict";
|
|
7150
|
+
|
|
7151
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7152
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7153
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7154
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7155
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7156
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7157
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7158
|
+
});
|
|
7159
|
+
};
|
|
7160
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
7161
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
7162
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
7163
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
7164
|
+
function step(op) {
|
|
7165
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
7166
|
+
while (_) try {
|
|
7167
|
+
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;
|
|
7168
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
7169
|
+
switch (op[0]) {
|
|
7170
|
+
case 0: case 1: t = op; break;
|
|
7171
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
7172
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
7173
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
7174
|
+
default:
|
|
7175
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
7176
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
7177
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
7178
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
7179
|
+
if (t[2]) _.ops.pop();
|
|
7180
|
+
_.trys.pop(); continue;
|
|
7181
|
+
}
|
|
7182
|
+
op = body.call(thisArg, _);
|
|
7183
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
7184
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
7185
|
+
}
|
|
7186
|
+
};
|
|
7187
|
+
exports.__esModule = true;
|
|
7188
|
+
exports.startKubePortForward = void 0;
|
|
7189
|
+
var portForwards_1 = __nccwpck_require__(15237);
|
|
7190
|
+
var startKubePortForward = function (podname, localPort, remotePort, namespace) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7191
|
+
var name;
|
|
7192
|
+
return __generator(this, function (_a) {
|
|
7193
|
+
switch (_a.label) {
|
|
7194
|
+
case 0:
|
|
7195
|
+
name = "kube/".concat(namespace, "/").concat(podname, "/").concat(localPort, ":").concat(remotePort);
|
|
7196
|
+
return [4 /*yield*/, (0, portForwards_1.startPortForwardCommand)(name, "kubectl port-forward ".concat(podname, " ").concat(localPort, ":").concat(remotePort, " -n ").concat(namespace))];
|
|
7197
|
+
case 1:
|
|
7198
|
+
_a.sent();
|
|
7199
|
+
return [2 /*return*/];
|
|
7200
|
+
}
|
|
7201
|
+
});
|
|
7202
|
+
}); };
|
|
7203
|
+
exports.startKubePortForward = startKubePortForward;
|
|
7204
|
+
//# sourceMappingURL=portForward.js.map
|
|
7205
|
+
|
|
7206
|
+
/***/ }),
|
|
7207
|
+
|
|
7085
7208
|
/***/ 71628:
|
|
7086
7209
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
7087
7210
|
|
|
@@ -8176,7 +8299,7 @@ exports.trashItem = trashItem;
|
|
|
8176
8299
|
|
|
8177
8300
|
/***/ }),
|
|
8178
8301
|
|
|
8179
|
-
/***/
|
|
8302
|
+
/***/ 15237:
|
|
8180
8303
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
8181
8304
|
|
|
8182
8305
|
"use strict";
|
|
@@ -8229,7 +8352,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
8229
8352
|
}
|
|
8230
8353
|
};
|
|
8231
8354
|
exports.__esModule = true;
|
|
8232
|
-
exports.stopAllPortForwards = exports.
|
|
8355
|
+
exports.stopAllPortForwards = exports.startPortForwardCommand = exports.getAllRunningPortForwards = exports.stopPortForward = void 0;
|
|
8233
8356
|
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
8234
8357
|
var portForwards = new Map();
|
|
8235
8358
|
var stopPortForward = function (name) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -8262,30 +8385,34 @@ var getAllRunningPortForwards = function () {
|
|
|
8262
8385
|
return Array.from(portForwards.keys());
|
|
8263
8386
|
};
|
|
8264
8387
|
exports.getAllRunningPortForwards = getAllRunningPortForwards;
|
|
8265
|
-
var
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8388
|
+
var addPortForward = function (name, portForward) {
|
|
8389
|
+
portForwards.set(name, portForward);
|
|
8390
|
+
};
|
|
8391
|
+
var startPortForwardCommand = function (name, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8392
|
+
var _a, cmd, args, promise;
|
|
8393
|
+
return __generator(this, function (_b) {
|
|
8394
|
+
switch (_b.label) {
|
|
8395
|
+
case 0:
|
|
8396
|
+
// stop if already there
|
|
8397
|
+
return [4 /*yield*/, (0, exports.stopPortForward)(name)];
|
|
8398
|
+
case 1:
|
|
8271
8399
|
// stop if already there
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
promise = (0, child_process_promise_1.spawn)("kubectl", ["port-forward", podname, "".concat(localPort, ":").concat(remotePort), "-n", namespace], {
|
|
8400
|
+
_b.sent();
|
|
8401
|
+
_a = command.split(" "), cmd = _a[0], args = _a.slice(1);
|
|
8402
|
+
promise = (0, child_process_promise_1.spawn)(cmd, args, {
|
|
8276
8403
|
env: __assign(__assign({}, process.env), { DEBUG: "" })
|
|
8277
8404
|
});
|
|
8278
|
-
|
|
8405
|
+
addPortForward(name, promise);
|
|
8279
8406
|
// wait a moment so that is surley started, unfortunatly we don't know that
|
|
8280
8407
|
return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 1000); })];
|
|
8281
|
-
case
|
|
8408
|
+
case 2:
|
|
8282
8409
|
// wait a moment so that is surley started, unfortunatly we don't know that
|
|
8283
|
-
|
|
8410
|
+
_b.sent();
|
|
8284
8411
|
return [2 /*return*/];
|
|
8285
8412
|
}
|
|
8286
8413
|
});
|
|
8287
8414
|
}); };
|
|
8288
|
-
exports.
|
|
8415
|
+
exports.startPortForwardCommand = startPortForwardCommand;
|
|
8289
8416
|
var stopAllPortForwards = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
8290
8417
|
return __generator(this, function (_a) {
|
|
8291
8418
|
(0, exports.getAllRunningPortForwards)().forEach(function (name) {
|
|
@@ -8295,7 +8422,7 @@ var stopAllPortForwards = function () { return __awaiter(void 0, void 0, void 0,
|
|
|
8295
8422
|
});
|
|
8296
8423
|
}); };
|
|
8297
8424
|
exports.stopAllPortForwards = stopAllPortForwards;
|
|
8298
|
-
//# sourceMappingURL=
|
|
8425
|
+
//# sourceMappingURL=portForwards.js.map
|
|
8299
8426
|
|
|
8300
8427
|
/***/ }),
|
|
8301
8428
|
|
|
@@ -351199,7 +351326,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351199
351326
|
|
|
351200
351327
|
exports.__esModule = true;
|
|
351201
351328
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351202
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
351329
|
+
exports.PIPELINE_IMAGE_TAG = "main-79f19757" || 0;
|
|
351203
351330
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351204
351331
|
|
|
351205
351332
|
/***/ }),
|
|
@@ -352457,19 +352584,19 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
352457
352584
|
};
|
|
352458
352585
|
});
|
|
352459
352586
|
var getServiceDeployScript = function (service, nameSuffix) {
|
|
352460
|
-
var _a;
|
|
352587
|
+
var _a, _b;
|
|
352461
352588
|
var customConfig = service !== true ? service : undefined;
|
|
352462
352589
|
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
|
|
352463
352590
|
var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
|
|
352464
352591
|
command: command ? '"' + command.split(" ").join(",") + '"' : undefined
|
|
352465
352592
|
}, commonDeployArgs), {
|
|
352466
352593
|
"env-vars-file": "____envvars.yaml",
|
|
352467
|
-
"allow-unauthenticated": true,
|
|
352468
352594
|
"min-instances": customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances,
|
|
352469
352595
|
"max-instances": customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances,
|
|
352470
352596
|
"no-cpu-throttling": customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling
|
|
352471
352597
|
}));
|
|
352472
|
-
|
|
352598
|
+
var authenticationString = ((_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _b !== void 0 ? _b : true) ? "--allow-unauthenticated" : "--no-allow-unauthenticated";
|
|
352599
|
+
return "gcloud run deploy ".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "", " ").concat(argsString, " ").concat(authenticationString);
|
|
352473
352600
|
};
|
|
352474
352601
|
var getJobCreateScriptsForJob = function (jobName, job) {
|
|
352475
352602
|
// due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
|
|
@@ -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"}
|