Skip to content
IJK

KYAML: A Strict Subset of YAML and Why It Needs No New Parser

By IJK ·

What the Kubernetes post says KYAML is, why SIG CLI chose a subset rather than a new language and the YAML choices it names as causing trouble.

What KYAML is

Instead of introducing a new configuration language, SIG CLI introduced KYAML, a stricter, more consistent way to write YAML. [1]

KYAML is a strict subset (or "dialect") of standard YAML, designed to be parseable by the existing ecosystem without any changes, as proposed in KEP 5295. [2]

narrowed toparseable byStandard YAMLKYAMLa strict subset, or dialect, of YAMLExisting parsersno changes needed
How does KYAML relate to standard YAML and to the existing parsers?

Why a subset instead of a new language

The interesting part is that Kubernetes doesn't actually need most of those features. [3]

This led to a simple question: if Kubernetes only needs a small part of YAML, why not standardize on that part and avoid the rest? [4]

The YAML choices that cause trouble

Indentation defines structure in YAML, which means a wrongly indented file can remain syntactically valid while representing a different object than intended. [5]

String quoting is optional in YAML, which sounds convenient until it is not. [6]

Some values that look like strings get coerced into other types without warning. [7]

Sources

  1. The Kubernetes project source says: Instead of introducing a new configuration language, SIG CLI introduced KYAML, a stricter, more consistent way to write YAML. How to Pretty-Print Your Kubernetes YAML as KYAML
  2. The Kubernetes project source says: KYAML is a strict subset (or "dialect") of standard YAML, designed to be parseable by the existing ecosystem without any changes, as proposed in KEP 5295. How to Pretty-Print Your Kubernetes YAML as KYAML
  3. The Kubernetes project source says: The interesting part is that Kubernetes doesn't actually need most of those features. How to Pretty-Print Your Kubernetes YAML as KYAML
  4. The Kubernetes project source says: This led to a simple question: if Kubernetes only needs a small part of YAML, why not standardize on that part and avoid the rest? How to Pretty-Print Your Kubernetes YAML as KYAML
  5. The Kubernetes project source says: Indentation defines structure in YAML, which means a wrongly indented file can remain syntactically valid while representing a different object than intended. How to Pretty-Print Your Kubernetes YAML as KYAML
  6. The Kubernetes project source says: String quoting is optional in YAML, which sounds convenient until it is not. How to Pretty-Print Your Kubernetes YAML as KYAML
  7. The Kubernetes project source says: Some values that look like strings get coerced into other types without warning. How to Pretty-Print Your Kubernetes YAML as KYAML

Editorial (AI-assisted; automatically checked, not human-reviewed). Each statement is linked to its source; check the source before relying on a detail.

  • kubernetes
  • yaml
  • kyaml
  • configuration