Skip to content

Talos apid should discard empty documents #12649

@jobo-prod

Description

@jobo-prod

Feature Request

Description

Submitting YAML that contains empty documents (double --- without content inbetween) fails with

expected a mapping node

While this is technically correct, it can lead to some debugging headache, because the issue is hard to spot for the human eye.

Especially since Talos now encourages multi-doc configuration, this issue is more likely to happen. It could be caused by templating/code generation, or by commenting out a resource from the file. In my case, it simply happened because I wanted to add some "sections" denoted by visually separated comments, like this:

---
apiVersion: v1alpha1
machine: ...
cluster: ...
---
##### DISK LAYOUT #####
---
# Leave room for another partition (disk is 100GB)
apiVersion: v1alpha1
kind: VolumeConfig
name: EPHEMERAL
provisioning:
  maxSize: 80GB

It took me a while to figure out the cause of the error.

I'd suggest that the server should simply discard empty documents before schema validation. If there is a good reason not to to that, it might still be worth adding a hint to the error message.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions