Skip to content

KCL 0.12 converts the string "yes" into yes when outputting yaml, which breaks yaml 1.1 parsers like Kubernetes #2013

@cypres

Description

@cypres

Bug Report

Yaml 1.2 no longer recognize yes as a boolean, but Yaml 1.1 does, which includes Kubernetes. Meaning if you use KCL 0.12 with Kubernetes and set a string "yes" it becomes a boolean instead, causing type errors such as:

Deployment: json: cannot unmarshal bool into Go struct field EnvVar.spec.template.spec.containers.env.value of type string

This would be fairly common in the EnvVar's for a ContainerSpec, where a user is likely to set an environment variable to a string "yes", which KCL now handles incorrectly.

This is a regression from KCL 0.11.4

1. Minimal reproduce step (Required)

import manifests

schema Foo:
    a: str

foo = Foo {
    a: "yes"
}

manifests.yaml_stream([foo])

2. What did you expect to see? (Required)

a: 'yes'

3. What did you see instead (Required)

a: yes

4. What is your KCL components version? (Required)

KCL 0.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions