Comparing version 0.13.1 to 0.14.0-pre.7b1d613d49623548c5823953be938f281e12269f
@@ -89,2 +89,6 @@ import { Construct } from '@aws-cdk/core'; | ||
constructor(scope: Construct, ns: string, options: ApiObjectOptions); | ||
/** | ||
* Renders the object to Kubernetes JSON. | ||
*/ | ||
toJson(): any; | ||
} |
@@ -5,2 +5,4 @@ "use strict"; | ||
const chart_1 = require("./chart"); | ||
const _util_1 = require("./_util"); | ||
const _tokens_1 = require("./_tokens"); | ||
class ApiObject extends core_1.Construct { | ||
@@ -24,7 +26,6 @@ /** | ||
/** | ||
* Renders the object to Kubernetes config. | ||
* @internal | ||
* Renders the object to Kubernetes JSON. | ||
*/ | ||
_render() { | ||
return { | ||
toJson() { | ||
const data = { | ||
...this.options, | ||
@@ -36,5 +37,8 @@ metadata: { | ||
}; | ||
// convert to "pure data" so, for example, when we convert to yaml these | ||
// references are not converted to anchors. | ||
return JSON.parse(JSON.stringify(_util_1.removeEmpty(_tokens_1.resolve(this, data)))); | ||
} | ||
} | ||
exports.ApiObject = ApiObject; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLW9iamVjdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImFwaS1vYmplY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3Q0FBMEM7QUFDMUMsbUNBQWdDO0FBa0VoQyxNQUFhLFNBQVUsU0FBUSxnQkFBUztJQXlCdEM7Ozs7OztPQU1HO0lBQ0gsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBbUIsT0FBeUI7O1FBQ2xGLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFEd0MsWUFBTyxHQUFQLE9BQU8sQ0FBa0I7UUFFbEYsSUFBSSxDQUFDLEtBQUssR0FBRyxhQUFLLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQzVCLElBQU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XG4gIHB1YmxpYyB0b0pzb24oKTogYW55IHtcbiAgICBjb25zdCBkYXRhID0ge1xuICAgICAgLi4udGhpcy5vcHRpb25zLFxuICAgICAgbWV0YWRhdGE6IHtcbiAgICAgICAgLi4udGhpcy5vcHRpb25zLm1ldGFkYXRhLFxuICAgICAgICBuYW1lOiB0aGlzLm5hbWVcbiAgICAgIH1cbiAgICB9O1xuXG4gICAgLy8gY29udmVydCB0byBcInB1cmUgZGF0YVwiIHNvLCBmb3IgZXhhbXBsZSwgd2hlbiB3ZSBjb252ZXJ0IHRvIHlhbWwgdGhlc2VcbiAgICAvLyByZWZlcmVuY2VzIGFyZSBub3QgY29udmVydGVkIHRvIGFuY2hvcnMuXG4gICAgcmV0dXJuIEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkocmVtb3ZlRW1wdHkocmVzb2x2ZSh0aGlzLCBkYXRhKSkpKTtcbiAgfVxufVxuXG4iXX0= |
@@ -36,3 +36,11 @@ import { Construct, ISynthesisSession } from '@aws-cdk/core'; | ||
generateObjectName(apiObject: ApiObject): string; | ||
/** | ||
* Renders this chart to a set of Kubernetes JSON resources. | ||
* @returns array of resource manifests | ||
*/ | ||
toJson(): any[]; | ||
/** | ||
* Called by the app to synthesize the chart as a YAML file in the output directory/ | ||
*/ | ||
protected synthesize(session: ISynthesisSession): void; | ||
} |
@@ -8,4 +8,2 @@ "use strict"; | ||
const YAML = require("yaml"); | ||
const _tokens_1 = require("./_tokens"); | ||
const _util_1 = require("./_util"); | ||
const names_1 = require("./names"); | ||
@@ -54,13 +52,15 @@ class Chart extends core_1.Construct { | ||
} | ||
/** | ||
* Renders this chart to a set of Kubernetes JSON resources. | ||
* @returns array of resource manifests | ||
*/ | ||
toJson() { | ||
return this.node.findAll().filter(x => x instanceof api_object_1.ApiObject).map(x => x.toJson()); | ||
} | ||
/** | ||
* Called by the app to synthesize the chart as a YAML file in the output directory/ | ||
*/ | ||
synthesize(session) { | ||
const resources = new Array(); | ||
for (const resource of this.node.findAll()) { | ||
if (!(resource instanceof api_object_1.ApiObject)) { | ||
continue; | ||
} | ||
const manifest = _util_1.removeEmpty(_tokens_1.resolve(this, resource._render())); | ||
resources.push(manifest); | ||
} | ||
// convert each resource to yaml and separate with a '---' line | ||
const doc = resources.map(r => toYaml(r)).join('---\n'); | ||
const doc = this.toJson().map(r => YAML.stringify(r)).join('---\n'); | ||
fs.writeFileSync(path.join(session.assembly.outdir, this.manifestFile), doc); | ||
@@ -70,7 +70,2 @@ } | ||
exports.Chart = Chart; | ||
function toYaml(o) { | ||
// lose anchors which are based on reference equality | ||
const x = JSON.parse(JSON.stringify(o)); | ||
return YAML.stringify(x); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJjaGFydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHdDQUE2RDtBQUM3RCx5QkFBeUI7QUFDekIsNkJBQTZCO0FBQzdCLDZDQUF5QztBQUN6Qyw2QkFBNkI7QUFDN0IsdUNBQW9DO0FBQ3BDLG1DQUFzQztBQUN0QyxtQ0FBZ0M7QUFFaEMsTUFBYSxLQUFNLFNBQVEsZ0JBQVM7SUF5QmxDLFlBQVksS0FBZ0IsRUFBRSxFQUFVO1FBQ3RDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFDakIsSUFBSSxDQUFDLFlBQVksR0FBRyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsUUFBUSxXQUFXLENBQUM7SUFDdkQsQ0FBQztJQTFCRDs7O09BR0c7SUFDSSxNQUFNLENBQUMsRUFBRSxDQUFDLElBQWU7UUFDOUIsSUFBSSxJQUFJLFlBQVksS0FBSyxFQUFFO1lBQ3pCLE9BQU8sSUFBSSxDQUFDO1NBQ2I7UUFFRCxNQUFNLE1BQU0sR0FBRyxJQUFJLENBQUMsSU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ge1xuICAgIHJldHVybiB0aGlzLm5vZGUuZmluZEFsbCgpLmZpbHRlcih4ID0+IHggaW5zdGFuY2VvZiBBcGlPYmplY3QpLm1hcCh4ID0+ICh4IGFzIEFwaU9iamVjdCkudG9Kc29uKCkpO1xuICB9XG5cbiAgLyoqXG4gICAqIENhbGxlZCBieSB0aGUgYXBwIHRvIHN5bnRoZXNpemUgdGhlIGNoYXJ0IGFzIGEgWUFNTCBmaWxlIGluIHRoZSBvdXRwdXQgZGlyZWN0b3J5L1xuICAgKi9cbiAgcHJvdGVjdGVkIHN5bnRoZXNpemUoc2Vzc2lvbjogSVN5bnRoZXNpc1Nlc3Npb24pIHtcbiAgICAvLyBjb252ZXJ0IGVhY2ggcmVzb3VyY2UgdG8geWFtbCBhbmQgc2VwYXJhdGUgd2l0aCBhICctLS0nIGxpbmVcbiAgICBjb25zdCBkb2MgPSB0aGlzLnRvSnNvbigpLm1hcChyID0+IFlBTUwuc3RyaW5naWZ5KHIpKS5qb2luKCctLS1cXG4nKTtcbiAgICBmcy53cml0ZUZpbGVTeW5jKHBhdGguam9pbihzZXNzaW9uLmFzc2VtYmx5Lm91dGRpciwgdGhpcy5tYW5pZmVzdEZpbGUpLCBkb2MpO1xuICB9XG59XG4iXX0= |
@@ -41,16 +41,9 @@ "use strict"; | ||
} | ||
const components = path.split('/'); | ||
// verify components only use allowed chars. | ||
for (const comp of components) { | ||
if (!VALIDATE.test(comp)) { | ||
throw new Error(`"${comp}" is not a valid object name. The characters allowed in names are: digits (0-9), lower case letters (a-z), -, and .`); | ||
} | ||
if (comp.length > maxLen) { | ||
throw new Error(`Object name "${comp}" is too long. Maximum allowed length is ${maxLen}`); | ||
} | ||
} | ||
// special case: if we only have one component in our path, we don't decorate it | ||
if (components.length === 1) { | ||
let components = path.split('/'); | ||
// special case: if we only have one component in our path and it adheres to DNS_NAME, we don't decorate it | ||
if (components.length === 1 && VALIDATE.test(components[0]) && components[0].length <= maxLen) { | ||
return components[0]; | ||
} | ||
// okay, now we need to normalize all components to adhere to DNS_NAME and append the hash of the full path. | ||
components = components.map(c => normalizeToDnsName(c, maxLen)); | ||
components.push(calcHash(path, HASH_LEN)); | ||
@@ -72,2 +65,8 @@ return components | ||
exports.Names = Names; | ||
function normalizeToDnsName(c, maxLen) { | ||
return c | ||
.toLocaleLowerCase() // lower case | ||
.replace(/[^0-9a-z-]/g, '') // remove non-allowed characters | ||
.substr(0, maxLen); // trim to maxLength | ||
} | ||
function calcHash(path, maxLen) { | ||
@@ -78,2 +77,2 @@ const hash = crypto.createHash('sha256'); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmFtZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJuYW1lcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlDQUFpQztBQUVqQyxNQUFNLGdCQUFnQixHQUFHLEVBQUUsQ0FBQztBQUM1QixNQUFNLFFBQVEsR0FBRyxjQUFjLENBQUM7QUFDaEMsTUFBTSxRQUFRLEdBQUcsQ0FBQyxDQUFDO0FBRW5COztHQUVHO0FBQ0gsTUFBYSxLQUFLO0lBQ2hCOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O09BeUJHO0lBQ0ksTUFBTSxDQUFDLFVBQVUsQ0FBQyxJQUFZLEVBQUUsTUFBTSxHQUFHLGdCQUFnQjtRQUM5RCxJQUFJLE1BQU0sR0FBRyxRQUFRLEVBQUU7WUFDckIsTUFBTSxJQUFJLEtBQUssQ0FBQywwQ0FBMEMsUUFBUSxzQkFBc0IsQ0FBQyxDQUFDO1NBQzNGO1FBRUQsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUVuQyw0Q0FBNEM7UUFDNUMsS0FBSyxNQUFNLElBQUksSUFBSSxVQUFVLEVBQUU7WUFDN0IsSUFBSSxDQUFDLFFBQVEs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2FzZVxuICAgIC5yZXBsYWNlKC9bXjAtOWEtei1dL2csICcnKSAvLyByZW1vdmUgbm9uLWFsbG93ZWQgY2hhcmFjdGVyc1xuICAgIC5zdWJzdHIoMCwgbWF4TGVuKSAgICAgICAgICAvLyB0cmltIHRvIG1heExlbmd0aFxufVxuXG5mdW5jdGlvbiBjYWxjSGFzaChwYXRoOiBzdHJpbmcsIG1heExlbjogbnVtYmVyKSB7XG4gIGNvbnN0IGhhc2ggPSBjcnlwdG8uY3JlYXRlSGFzaCgnc2hhMjU2Jyk7XG4gIGhhc2gudXBkYXRlKHBhdGgpO1xuICByZXR1cm4gaGFzaC5kaWdlc3QoJ2hleCcpLnNsaWNlKDAsIG1heExlbik7XG59Il19 |
@@ -7,3 +7,2 @@ "use strict"; | ||
const lib_1 = require("../lib"); | ||
const YAML = require("yaml"); | ||
/** | ||
@@ -25,6 +24,3 @@ * Testing utilities for cdk8s applications. | ||
static synth(chart) { | ||
const app = chart.node.root; | ||
app.synth(); | ||
const filePath = path.join(app.outdir, chart.manifestFile); | ||
return YAML.parseAllDocuments(fs.readFileSync(filePath, 'utf-8')).map((doc) => doc.toJSON()); | ||
return chart.toJson(); | ||
} | ||
@@ -37,2 +33,2 @@ /* istanbul ignore next */ | ||
exports.Testing = Testing; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3RpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5QkFBMEI7QUFDMUIsNkJBQThCO0FBQzlCLHlCQUEwQjtBQUMxQixnQ0FBb0M7QUFDcEMsNkJBQTZCO0FBRTdCOztHQUVHO0FBQ0gsTUFBYSxPQUFPO0lBQ2xCOzs7T0FHRztJQUNJLE1BQU0sQ0FBQyxHQUFHO1FBQ2YsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDLFdBQVcsQ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tcCBkaXIuXG4gICAqL1xuICBwdWJsaWMgc3RhdGljIGFwcCgpIHtcbiAgICBjb25zdCBvdXRkaXIgPSBmcy5ta2R0ZW1wU3luYyhwYXRoLmpvaW4ob3MudG1wZGlyKCksICdjZGs4cy5vdXRkaXIuJykpO1xuICAgIHJldHVybiBuZXcgQXBwKHsgb3V0ZGlyIH0pO1xuICB9XG5cbiAgLyoqXG4gICAqIFJldHVybnMgdGhlIEt1YmVybmV0ZXMgbWFuaWZlc3Qgc3ludGhlc2l6ZWQgZnJvbSB0aGlzIGNoYXJ0LlxuICAgKi9cbiAgcHVibGljIHN0YXRpYyBzeW50aChjaGFydDogQ2hhcnQpIHtcbiAgICByZXR1cm4gY2hhcnQudG9Kc29uKCk7XG4gIH1cblxuICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICBwcml2YXRlIGNvbnN0cnVjdG9yKCkge1xuICAgIHJldHVybjtcbiAgfVxufVxuIl19 |
{ | ||
"name": "cdk8s", | ||
"version": "0.13.1", | ||
"version": "0.14.0-pre.7b1d613d49623548c5823953be938f281e12269f", | ||
"description": "Cloud Development Kit for Kubernetes", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
673090
16739