Skip to content

KYAML output format #4410

Description

@mxey

Is your feature request related to a problem? Please describe.
The Kubernetes project has introduced KYAML as an output format. It is not really a new format, but rather a YAML subset that makes it look like JSON with comments.

There is a chance that this becomes the dominant formatting of YAML in Kubernetes contexts.

Describe the solution you'd like

Add KYAML as a format to CUE, as "-o kyaml" and and as CUE functions. This would make the output of CUE seem more natural and IMO it's just a more readable format.

Describe alternatives you've considered

Keep using YAML output: any Kubernetes YAML parser will continue to accept this, but using KYAML might feel more natural

Send the output of CUE through a KYAML formatter: an annoying extra step.

JSON output: JSON does not support multiple documents in a file, which makes it harder to feed into kubectl apply.

Change CUE's YAML output to be KYAML: since KYAML is totally valid YAML, that would be “legal” but not what people expect when they ask for YAML, most likely.

Add KYAML formatting as some kind of flag to the YAML output?

Additional context

KEP-5295: Introducing KYAML, a safer, less ambiguous YAML subset / encoding

https://github.com/google/yamlfmt supports KYAML formatting.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions