Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@01/kube-tools

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@01/kube-tools - npm Package Compare versions

Comparing version 1.0.19 to 2.0.0-alpha

572

dist/index.js

@@ -35,3 +35,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "5151c239b067e49b9646";
/******/ var hotCurrentHash = "7635056d63e150b76d44";
/******/ var hotRequestTimeout = 10000;

@@ -787,28 +787,46 @@ /******/ var hotCurrentModuleData = {};

// EXTERNAL MODULE: external "lodash.get"
var external_lodash_get_ = __webpack_require__("lodash.get");
var external_lodash_get_default = /*#__PURE__*/__webpack_require__.n(external_lodash_get_);
// CONCATENATED MODULE: ./src/components/obj/merge-obj.ts
function mergeObjects(object1, object2) {
var result = {};
var keys2 = Object.keys(object2);
Object.keys(object1).forEach(function (key1) {
var obj1 = object1[key1];
var key2index = keys2.indexOf(key1);
if (key2index > -1) {
var key2 = keys2.splice(key2index, 1)[0];
var obj2 = object2[key2];
if (typeof obj2 === "object" && !Array.isArray(obj2)) {
var mergedObj = mergeObjects(obj1, obj2);
result[key1] = mergedObj;
var defaultOptions = {
skipDuplicates: false
};
function mergeObjects(object1, object2, options) {
if (options === void 0) { options = defaultOptions; }
if (object1 && object2) {
if (Array.isArray(object1) && Array.isArray(object2)) {
var result_1 = object1.concat(object2);
if (options.skipDuplicates) {
result_1 = Array.from(new Set(result_1));
}
return result_1;
}
var result_2 = {};
var keys2_1 = Object.keys(object2);
Object.keys(object1).forEach(function (key1) {
var obj1 = object1[key1];
var key2index = keys2_1.indexOf(key1);
if (key2index > -1) {
var key2 = keys2_1.splice(key2index, 1)[0];
var obj2 = object2[key2];
if (typeof obj2 === "object") {
var mergedObj = mergeObjects(obj1, obj2, options);
result_2[key1] = mergedObj;
}
else {
result_2[key1] = obj2;
}
}
else {
result[key1] = obj2;
result_2[key1] = obj1;
}
}
else {
result[key1] = obj1;
}
});
keys2.forEach(function (key2) {
result[key2] = object2[key2];
});
return result;
});
keys2_1.forEach(function (key2) {
result_2[key2] = object2[key2];
});
return result_2;
}
return object1 || object2 || {};
}

@@ -819,30 +837,62 @@

function loadConfig(path) {
function loadConfig(path, overrideValues) {
if (overrideValues === void 0) { overrideValues = {}; }
try {
var basePath = path.substring(0, path.lastIndexOf("/"));
console.log(path);
var doc = Object(external_sls_yaml_["readYamlSync"])(path);
console.log("Check #1.2");
// Merge helm values and chart
var valuesSource = doc.app.helm.values;
if (valuesSource && Array.isArray(valuesSource)) {
var values = valuesSource.reduce(function (acc, item) {
if (item) {
acc = mergeObjects(acc, item);
var values_1;
var doc = Object(external_sls_yaml_["readYamlSync"])(path, null, {
merge: function (_a) {
var obj1 = _a[0], obj2 = _a[1];
return mergeObjects(obj1, obj2);
},
values: function (_a, _b) {
var key = _a[0];
var globalObj = _b.globalObj;
if (!values_1) {
values_1 = mergeObjects(globalObj.app.service.values, overrideValues);
}
return acc;
}, {});
delete doc.values;
delete doc.app.values;
doc.app.helm.values = values;
return external_lodash_get_default()(values_1, key);
}
});
if (doc.app.service) {
// Merge service values
var valuesSource = doc.app.service.values;
if (valuesSource && Array.isArray(valuesSource)) {
var values_2 = valuesSource.reduce(function (acc, item) {
if (item) {
acc = mergeObjects(acc, item);
}
return acc;
}, {});
delete doc.values;
delete doc.app.values;
doc.app.service.values = values_2;
}
}
var chartSource = doc.app.helm.chart;
if (chartSource && Array.isArray(chartSource)) {
var chart = chartSource.reduce(function (acc, item) {
if (item) {
acc = mergeObjects(acc, item);
}
return acc;
}, {});
doc.app.helm.chart = chart;
if (doc.app.helm) {
// Merge helm values and chart
var valuesSource = doc.app.helm.values;
if (valuesSource && Array.isArray(valuesSource)) {
var values_3 = valuesSource.reduce(function (acc, item) {
if (item) {
acc = mergeObjects(acc, item);
}
return acc;
}, {});
delete doc.values;
delete doc.app.values;
doc.app.helm.values = values_3;
}
var chartSource = doc.app.helm.chart;
if (chartSource && Array.isArray(chartSource)) {
var chart = chartSource.reduce(function (acc, item) {
if (item) {
acc = mergeObjects(acc, item);
}
return acc;
}, {});
doc.app.helm.chart = chart;
}
}

@@ -857,8 +907,60 @@ doc.basePath = basePath;

// CONCATENATED MODULE: ./src/kube-deploy.ts
// CONCATENATED MODULE: ./src/components/kubernetes/kubectl.ts
var kube_deploy_path = __webpack_require__("path");
function kubectl(args, launchOptions) {
if (launchOptions === void 0) { launchOptions = {}; }
return external_tslib_["__awaiter"](this, void 0, void 0, function () {
return external_tslib_["__generator"](this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Object(launcher_["launch"])(external_tslib_["__assign"]({ cmds: ["kubectl"].concat(args), stdio: "pipe" }, launchOptions))];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
}
// CONCATENATED MODULE: ./src/components/kubernetes/index.ts
// EXTERNAL MODULE: external "crypto"
var external_crypto_ = __webpack_require__("crypto");
// CONCATENATED MODULE: ./src/common/object-hash.ts
function objectHash(obj) {
if (typeof obj === "object") {
if (Array.isArray(obj)) {
return arrayHash(obj);
}
else {
var keys = Object.keys(obj).sort();
var sortedHashMap = keys.map(function (key) { return [
key,
objectHash(obj[key])
]; });
return external_crypto_["createHash"]("md5")
.update(JSON.stringify(sortedHashMap))
.digest("hex");
}
}
return external_crypto_["createHash"]("md5")
.update(JSON.stringify(obj))
.digest("hex");
}
function arrayHash(array) {
var sortedHashMap = array.map(function (item) { return objectHash(item); });
return external_crypto_["createHash"]("md5")
.update(JSON.stringify(sortedHashMap))
.digest("hex");
}
// CONCATENATED MODULE: ./src/kube-deploy-v2.ts
var kube_deploy_v2_path = __webpack_require__("path");
var fs = __webpack_require__("fs-extra");
var chalk = __webpack_require__("chalk");
var yaml = __webpack_require__("js-yaml");
var util = __webpack_require__("util");
var kube_deploy_v2_crypto = __webpack_require__("crypto");

@@ -868,24 +970,7 @@

var cwd = process.cwd();
var helmValueSets = function (values) {
return values.map(function (_a) {
var name = _a.name, value = _a.value;
return ["--set", name + "=" + value];
}).flat();
};
// prettier-ignore
var kube_deploy_helm = function (_a) {
var name = _a.name, chart = _a.chart, values = _a.values, valuesOverrides = _a.valuesOverrides, _b = _a.dryRun, dryRun = _b === void 0 ? false : _b;
return [
"helm",
"upgrade"
].concat((dryRun ? ["--dry-run"] : []), [
"--install"
], (values ? ["--values", values] : []), helmValueSets(valuesOverrides), [
name,
chart // helm chart
]);
};
var white = chalk.white, red = chalk.red, blue = chalk.blue, bgRed = chalk.bgRed;
var defaultOptions = {
var kube_deploy_v2_defaultOptions = {
name: "",

@@ -899,4 +984,4 @@ basePath: ".",

function printConfig(_a) {
var name = _a.name, env = _a.env, _b = _a.helm, release = _b.release, chartFile = _b.chartFile, valuesFile = _b.valuesFile, _c = _b.values, image = _c.image, replicas = _c.replicas;
console.info(" \u2699\uFE0F Deployment Configuration\n \n \uD83D\uDE80 Release name : " + release + "\n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + image.tag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n \uD83D\uDCBF Image pullPolicy : " + image.pullPolicy + "\n \uD83D\uDC7E Replicas : " + replicas + "\n \uD83D\uDCCB Chart : " + chartFile + "\n \uD83D\uDCDD Values : " + valuesFile + "\n ");
var name = _a.name, env = _a.env, image = _a.image, replicas = _a.replicas, deployment = _a.deployment, subset = _a.subset;
console.info(" \u2699\uFE0F Deployment Configuration\n \n \uD83D\uDCE6 Service name : " + name + "\n \uD83D\uDE80 Deployment : " + deployment + "\n \uD83D\uDC23 Subset : " + subset + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + image.tag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n \uD83D\uDCBF Image pullPolicy : " + image.pullPolicy + "\n \uD83D\uDC7E Replicas : " + replicas + "\n ");
}

@@ -909,3 +994,3 @@ var logError = function (prop, msg) {

var yamlData = yaml.safeDump(data);
fs.outputFileSync(kube_deploy_path.resolve(cwd, _path), yamlData);
fs.outputFileSync(kube_deploy_v2_path.resolve(cwd, _path), yamlData);
}

@@ -916,15 +1001,13 @@ catch (e) {

};
var copyTemplatesToBuildDir = function (_path, buildDir) {
var copyTemplatesToBuildDir = function (_path) {
var files = fs.readdirSync(_path);
files.forEach(function (file) {
console.log("file:", file);
var name = file.substring(file.lastIndexOf("/"), file.length);
fs.copySync(file, kube_deploy_path.resolve(buildDir, name));
});
};
var copyYamlToBuildDir = function (source, destination) {
var copyYamlToBuildDir = function (_path, source) {
try {
var data = Object(external_sls_yaml_["readYamlSync"])(kube_deploy_path.resolve(cwd, source));
var data = Object(external_sls_yaml_["readYamlSync"])(kube_deploy_v2_path.resolve(cwd, source));
var yamlData = yaml.safeDump(data);
fs.outputFileSync(kube_deploy_path.resolve(cwd, destination), yamlData);
fs.outputFileSync(kube_deploy_v2_path.resolve(cwd, _path), yamlData);
}

@@ -935,38 +1018,26 @@ catch (e) {

};
function generateHelmManifests(manifests, basePath) {
function generateManifests(manifests, basePath) {
if (manifests) {
var output = manifests.output, chart = manifests.chart, values = manifests.values, templates_1 = manifests.templates;
var buildDir = kube_deploy_path.resolve(basePath, output);
var chartDir_1 = kube_deploy_path.resolve(buildDir, "chart");
fs.mkdirpSync(buildDir);
// Generate Chart and values
var chartFile = chartDir_1 + "/Chart.yaml";
if (typeof chart === "string") {
copyYamlToBuildDir(chart, chartFile);
// Copy templates yaml
copyTemplatesToBuildDir(kube_deploy_path.resolve(chart.substring(0, chart.lastIndexOf("/")), "templates"), kube_deploy_path.resolve(chartDir_1, "templates"));
}
else {
saveJsonAsYaml(chartFile, chart);
}
var valuesFile = chartDir_1 + "/values.yaml";
if (typeof values === "string") {
copyYamlToBuildDir(valuesFile, values);
}
else {
saveJsonAsYaml(valuesFile, values);
}
// Generate templates yaml
if (templates_1) {
Object.keys(templates_1).forEach(function (name) {
var template = templates_1[name];
var _path = chartDir_1 + ("/templates/" + name + ".yaml");
fs.outputFileSync(kube_deploy_path.resolve(cwd, _path), template);
var output = manifests.output, values = manifests.values, resources_1 = manifests.resources;
var buildDir_1 = kube_deploy_v2_path.resolve(basePath, output);
var resourceDir = buildDir_1 + "/resources";
fs.mkdirpSync(resourceDir);
// Generate resource yaml
var resourceFiles_1 = [];
if (resources_1) {
Object.keys(resources_1).forEach(function (name) {
var resource = resources_1[name];
var _path = buildDir_1 + ("/resources/" + name + ".yaml");
resourceFiles_1.push({
kind: resource.kind,
name: resource.metadata.name,
path: _path,
content: resource
});
fs.outputFileSync(kube_deploy_v2_path.resolve(cwd, _path), yaml.safeDump(resource));
});
}
return {
chartDir: chartDir_1,
chartFile: chartFile,
valuesFile: valuesFile,
chart: chart,
resourceFiles: resourceFiles_1,
resourceDir: resourceDir,
values: values

@@ -978,14 +1049,10 @@ };

function kubeDeploy(_options) {
if (_options === void 0) { _options = defaultOptions; }
if (_options === void 0) { _options = kube_deploy_v2_defaultOptions; }
return external_tslib_["__awaiter"](this, void 0, void 0, function () {
var config, basePath, setValues, valuesOverrides, helmConfig, _a, chartDir, valuesFile, chartFile, values, chart, releaseName, image, dryRun, options, kubeContext, services, serviceList, e_1, e_2;
return external_tslib_["__generator"](this, function (_b) {
switch (_b.label) {
var config, setValues, valuesOverrides, basePath, values, serviceConfig, serviceName, image, options, kubeContext, promises, e_1;
var _this = this;
return external_tslib_["__generator"](this, function (_a) {
switch (_a.label) {
case 0:
console.log("Check #1");
config = { app: {}, basePath: _options.basePath, values: {} };
if (_options.config) {
config = loadConfig(_options.config);
}
basePath = config.basePath || _options.basePath;
setValues = _options.set || [];

@@ -996,36 +1063,15 @@ valuesOverrides = setValues.map(function (setValue) {

});
console.log("Check #2");
helmConfig = generateHelmManifests(config.app.helm, basePath);
_a = _options.chart, chartDir = _a === void 0 ? "./helm" : _a, valuesFile = _options.values;
chartFile = chartDir + "/Chart.yaml";
values = {};
chart = {};
if (helmConfig) {
chartDir = helmConfig.chartDir;
chartFile = helmConfig.chartFile;
valuesFile = helmConfig.valuesFile;
chart = helmConfig.chart;
values = helmConfig.values;
if (_options.config) {
config = loadConfig(_options.config, valuesOverrides);
}
else {
if (chartFile) {
chart = Object(external_sls_yaml_["readYamlSync"])(chartFile);
}
if (valuesFile) {
values = Object(external_sls_yaml_["readYamlSync"])(valuesFile);
}
}
values = mergeObjects(values, valuesOverrides);
releaseName = config.app.helm.release;
basePath = config.basePath || _options.basePath;
values = config.app.service.values;
serviceConfig = generateManifests(config.app.service, basePath);
serviceName = values.name;
image = values.image;
dryRun = _options.dryRun;
options = external_tslib_["__assign"]({}, defaultOptions, config.app, _options, { basePath: basePath, env: config.env, helm: {
release: releaseName,
chartFile: chartFile,
valuesFile: valuesFile,
chart: chart,
options = external_tslib_["__assign"]({}, kube_deploy_v2_defaultOptions, config.app, _options, { basePath: basePath, env: config.env, service: {
values: values
} });
if (!releaseName) {
logError(" release ", "please name the release you want to deploy!");
if (!serviceName) {
logError(" service ", "which service you want to deploy!");
process.exit(1);

@@ -1039,7 +1085,2 @@ return [2 /*return*/];

}
if (!chartFile) {
logError(" chart ", "which chart you want to deploy!");
process.exit(1);
return [2 /*return*/];
}
kubeContext = options.context;

@@ -1057,51 +1098,99 @@ if (!kubeContext) return [3 /*break*/, 2];

*/
_b.sent();
_b.label = 2;
case 2: return [4 /*yield*/, Object(launcher_["launch"])({
cmds: ["helm", "list", "--short"],
stdio: ["pipe", "pipe", process.stderr]
})];
_a.sent();
_a.label = 2;
case 2:
/**
* Check if service already deployed
*/
// const services: string = await launch({
// cmds: ["helm", "list", "--short"],
// stdio: ["pipe", "pipe", process.stderr]
// });
// const serviceList = services.split("\n");
// if (serviceList.includes(serviceName)) {
// console.info(
// blue(`
// 🧩 Upgrading ${serviceName} ...
// `)
// );
// } else {
// console.info(`
// 🧩 Installing ${serviceName} ...
// `);
// }
printConfig(values);
if (!serviceConfig) return [3 /*break*/, 7];
_a.label = 3;
case 3:
services = _b.sent();
serviceList = services.split("\n");
if (serviceList.includes(releaseName)) {
console.info(blue("\n \uD83E\uDDE9 Upgrading " + releaseName + " ...\n "));
}
else {
console.info("\n \uD83E\uDDE9 Installing " + releaseName + " ...\n ");
}
printConfig(options);
_b.label = 4;
_a.trys.push([3, 6, , 7]);
promises = serviceConfig.resourceFiles.map(function (resourceFile) { return external_tslib_["__awaiter"](_this, void 0, void 0, function () {
var source, existingResource, mergedResource, hashes_1, http, hashes_2, subsets, e_2;
return external_tslib_["__generator"](this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, kubectl(["get", resourceFile.kind + "/" + resourceFile.name, "-o", "json"], { silent: true })];
case 1:
source = _a.sent();
if (["VirtualService", "DestinationRule"].includes(resourceFile.kind)) {
existingResource = JSON.parse(source);
mergedResource = mergeObjects(existingResource, resourceFile.content, { skipDuplicates: true } // Skip duplicate primitive values
);
// Filter duplicate resources
if (resourceFile.kind === "VirtualService") {
hashes_1 = [];
http = mergedResource.spec.http.filter(function (entry) {
var md5 = objectHash(entry);
if (!hashes_1.includes(md5)) {
hashes_1.push(md5);
return true;
}
return false;
});
mergedResource.spec.http = http;
}
if (resourceFile.kind === "DestinationRule") {
hashes_2 = [];
subsets = mergedResource.spec.subsets.filter(function (entry) {
var md5 = objectHash(entry);
if (!hashes_2.includes(md5)) {
hashes_2.push(md5);
return true;
}
return false;
});
mergedResource.spec.subsets = subsets;
}
fs.outputFileSync(resourceFile.path, yaml.safeDump(mergedResource));
return [2 /*return*/, mergedResource];
}
return [3 /*break*/, 3];
case 2:
e_2 = _a.sent();
console.error(e_2);
return [2 /*return*/, null];
case 3: return [2 /*return*/];
}
});
}); });
return [4 /*yield*/, Promise.all(promises)];
case 4:
_b.trys.push([4, 10, , 11]);
if (!options.redeploy) return [3 /*break*/, 8];
_b.label = 5;
_a.sent();
promises = serviceConfig.resourceFiles.map(function (resourceFile) { return external_tslib_["__awaiter"](_this, void 0, void 0, function () {
return external_tslib_["__generator"](this, function (_a) {
return [2 /*return*/, kubectl(["apply", "-f", resourceFile.path], {
silent: true,
stdio: "inherit"
})];
});
}); });
return [4 /*yield*/, Promise.all(promises)];
case 5:
_b.trys.push([5, 7, , 8]);
return [4 /*yield*/, Object(launcher_["launch"])({
cmds: ["helm", "del", "--purge", releaseName]
})];
_a.sent();
return [2 /*return*/, 0];
case 6:
_b.sent();
return [3 /*break*/, 8];
case 7:
e_1 = _b.sent();
return [3 /*break*/, 8];
case 8: return [4 /*yield*/, Object(launcher_["launch"])({
cmds: kube_deploy_helm({
name: releaseName,
dryRun: dryRun,
valuesOverrides: valuesOverrides,
chart: chartDir
// values: valuesFile
})
})];
case 9:
_b.sent();
return [2 /*return*/, 0];
case 10:
e_2 = _b.sent();
console.error(e_2);
e_1 = _a.sent();
console.error(e_1);
return [2 /*return*/, 1];
case 11: return [2 /*return*/];
case 7: return [2 /*return*/];
}

@@ -1287,18 +1376,18 @@ });

// CONCATENATED MODULE: ./src/kube-build.ts
// CONCATENATED MODULE: ./src/kube-build-v2.ts
var kube_build_chalk = __webpack_require__("chalk");
var kube_build_v2_chalk = __webpack_require__("chalk");
var kube_build_white = kube_build_chalk.white, kube_build_red = kube_build_chalk.red, kube_build_bgRed = kube_build_chalk.bgRed;
function kube_build_printConfig(_a) {
var env = _a.env, _b = _a.app, name = _b.name, _c = _b.helm.values.image, tag = _c.tag, repository = _c.repository;
console.info(" \u2699\uFE0F Build Configuration\n\n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + tag + "\n \uD83D\uDCBF Image repository : " + repository + "\n ");
var kube_build_v2_white = kube_build_v2_chalk.white, kube_build_v2_red = kube_build_v2_chalk.red, kube_build_v2_bgRed = kube_build_v2_chalk.bgRed;
function kube_build_v2_printConfig(_a) {
var env = _a.env, name = _a.name, image = _a.image;
console.info(" \u2699\uFE0F Build Configuration\n\n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + image.tag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n ");
}
var kube_build_logError = function (prop, msg) {
return console.error(kube_build_red("\nOops \uD83D\uDE2C, Did you forgot to pass option " + kube_build_bgRed(kube_build_white(" " + prop + " ")) + "?. Please tell me, " + msg + "!\n "));
var kube_build_v2_logError = function (prop, msg) {
return console.error(kube_build_v2_red("\nOops \uD83D\uDE2C, Did you forgot to pass option " + kube_build_v2_bgRed(kube_build_v2_white(" " + prop + " ")) + "?. Please tell me, " + msg + "!\n "));
};
function kubeBuild(_options) {
return external_tslib_["__awaiter"](this, void 0, void 0, function () {
var config, helm, _a, tag, imageRepository, dockerOptions, options, e_1;
var config, setValues, valuesOverrides, service, _a, tag, imageRepository, dockerOptions, options, e_1;
return external_tslib_["__generator"](this, function (_b) {

@@ -1309,11 +1398,16 @@ switch (_b.label) {

if (!_options.config) {
kube_build_logError(" config ", "Please provide a config file!");
kube_build_v2_logError(" config ", "Please provide a config file!");
process.exit(1);
return [2 /*return*/];
}
setValues = _options.set || [];
valuesOverrides = setValues.map(function (setValue) {
var _a = setValue.split("="), name = _a[0], value = _a[1];
return { name: name, value: value };
});
if (_options.config) {
config = loadConfig(_options.config);
config = loadConfig(_options.config, valuesOverrides);
}
helm = config.app.helm;
_a = helm.values.image, tag = _a.tag, imageRepository = _a.repository;
service = config.app.service;
_a = service.values.image, tag = _a.tag, imageRepository = _a.repository;
dockerOptions = {

@@ -1324,3 +1418,3 @@ tag: imageRepository + ":" + tag

delete options.config;
kube_build_printConfig(config);
kube_build_v2_printConfig(service.values);
_b.label = 1;

@@ -1343,19 +1437,19 @@ case 1:

// CONCATENATED MODULE: ./src/kube-push.ts
// CONCATENATED MODULE: ./src/kube-push-v2.ts
var kube_push_chalk = __webpack_require__("chalk");
var kube_push_v2_chalk = __webpack_require__("chalk");
var kube_push_white = kube_push_chalk.white, kube_push_red = kube_push_chalk.red, kube_push_bgRed = kube_push_chalk.bgRed;
function kube_push_printConfig(_a) {
var env = _a.env, tags = _a.tags, _b = _a.app, name = _b.name, _c = _b.helm.values.image, tag = _c.tag, repository = _c.repository;
console.info(" \u2699\uFE0F Build Configuration\n\n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tags : " + tags + "\n \uD83D\uDCBF Image repository : " + repository + "\n ");
var kube_push_v2_white = kube_push_v2_chalk.white, kube_push_v2_red = kube_push_v2_chalk.red, kube_push_v2_bgRed = kube_push_v2_chalk.bgRed;
function kube_push_v2_printConfig(_a) {
var env = _a.env, name = _a.name, image = _a.image;
console.info(" \u2699\uFE0F Build Configuration\n\n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + image.tag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n ");
}
var kube_push_logError = function (prop, msg) {
return console.error(kube_push_red("\nOops \uD83D\uDE2C, Did you forgot to pass option " + kube_push_bgRed(kube_push_white(" " + prop + " ")) + "?. Please tell me, " + msg + "!\n "));
var kube_push_v2_logError = function (prop, msg) {
return console.error(kube_push_v2_red("\nOops \uD83D\uDE2C, Did you forgot to pass option " + kube_push_v2_bgRed(kube_push_v2_white(" " + prop + " ")) + "?. Please tell me, " + msg + "!\n "));
};
function kubePush(_options) {
return external_tslib_["__awaiter"](this, void 0, void 0, function () {
var config, helm, _a, sourceTag, imageRepository, _b, _extraTags, extraTags, tags, dockerOptions, options, promises, e_1;
var config, setValues, valuesOverrides, service, _a, sourceTag, imageRepository, _b, _extraTags, extraTags, tags, dockerOptions, options, promises, e_1;
return external_tslib_["__generator"](this, function (_c) {

@@ -1366,13 +1460,18 @@ switch (_c.label) {

if (!_options.config) {
kube_push_logError(" config ", "Please provide a config file!");
kube_push_v2_logError(" config ", "Please provide a config file!");
process.exit(1);
return [2 /*return*/];
}
setValues = _options.set || [];
valuesOverrides = setValues.map(function (setValue) {
var _a = setValue.split("="), name = _a[0], value = _a[1];
return { name: name, value: value };
});
if (_options.config) {
config = loadConfig(_options.config);
config = loadConfig(_options.config, valuesOverrides);
}
helm = config.app.helm;
_a = helm.values.image, sourceTag = _a.tag, imageRepository = _a.repository;
service = config.app.service;
_a = service.values.image, sourceTag = _a.tag, imageRepository = _a.repository;
_b = _options["extra-tags"], _extraTags = _b === void 0 ? "" : _b;
extraTags = _extraTags.split(",");
extraTags = _extraTags.split(",").filter(function (tag) { return tag; });
tags = [sourceTag].concat(extraTags);

@@ -1384,3 +1483,3 @@ dockerOptions = {

delete options.config;
kube_push_printConfig(external_tslib_["__assign"]({}, config, { tags: tags }));
kube_push_v2_printConfig(service.values);
_c.label = 1;

@@ -1461,2 +1560,9 @@ case 1:

/***/ "crypto":
/***/ (function(module, exports) {
module.exports = require("crypto");
/***/ }),
/***/ "fs-extra":

@@ -1476,2 +1582,9 @@ /***/ (function(module, exports) {

/***/ "lodash.get":
/***/ (function(module, exports) {
module.exports = require("lodash.get");
/***/ }),
/***/ "minimist":

@@ -1503,2 +1616,9 @@ /***/ (function(module, exports) {

/***/ }),
/***/ "util":
/***/ (function(module, exports) {
module.exports = require("util");
/***/ })

@@ -1505,0 +1625,0 @@

{
"name": "@01/kube-tools",
"version": "1.0.19",
"version": "2.0.0-alpha",
"author": "Nidin Vinayakan <01@01alchemist.com>",

@@ -46,7 +46,9 @@ "repository": "git@github.com:01alchemist/kube-tools.git",

"core-js": "3.1.4",
"lodash.get": "^4.4.2",
"minimist": "1.2.0",
"sls-yaml": "1.0.28",
"sls-yaml": "1.0.29",
"source-map-support": "^0.5.12"
},
"devDependencies": {
"@types/lodash.get": "4.4.6",
"@types/jest": "24.0.13",

@@ -53,0 +55,0 @@ "@types/minimist": "1.2.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc