From 6a8d79ab8bea6e015e1448788befae94545b290f Mon Sep 17 00:00:00 2001 From: "Shinebayar G." <3091558+shinebayar-g@users.noreply.github.com> Date: Mon, 16 Dec 2024 23:55:03 -0800 Subject: [PATCH] fix(core): use yaml 1.1 schema to render (#44) otherwise boolean strings are automatically converted to boolean values --- packages/core/src/Helm.ts | 2 +- packages/core/src/K8sApp.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/Helm.ts b/packages/core/src/Helm.ts index 5ce0e2c..11a1a71 100644 --- a/packages/core/src/Helm.ts +++ b/packages/core/src/Helm.ts @@ -71,7 +71,7 @@ export class Helm { let tmpValuesDir = ''; if (args.valuesObject) { try { - const content = yaml.stringify(args.valuesObject); + const content = yaml.stringify(args.valuesObject, { schema: 'yaml-1.1' }); tmpValuesDir = fs.mkdtempSync(path.join(os.tmpdir(), 'k8skonf-helm-values-'), { encoding: 'utf-8', }); diff --git a/packages/core/src/K8sApp.ts b/packages/core/src/K8sApp.ts index 9df3dab..5954a78 100644 --- a/packages/core/src/K8sApp.ts +++ b/packages/core/src/K8sApp.ts @@ -24,7 +24,7 @@ export class K8sApp { } toYaml() { - return `---\n${this.resources.map((resource) => yaml.stringify(resource)).join('---\n')}`; + return `---\n${this.resources.map((resource) => yaml.stringify(resource, { schema: 'yaml-1.1' })).join('---\n')}`; } save() { @@ -41,7 +41,7 @@ export class K8sApp { ); fs.writeFileSync( path.join(this.outputName, `${r.kind}.${r.metadata.name}.yaml`), - yaml.stringify(r), + yaml.stringify(r, { schema: 'yaml-1.1' }), ); } } else {