talos icon indicating copy to clipboard operation
talos copied to clipboard

YAML output of machine config incorrectly formatted for multidoc configurations

Open steverfrancis opened this issue 9 months ago • 4 comments

Bug Report

Multidoc YAML configurations after the first document are incorrectly indented 4 spaces

Description

if you edit the machine config and append a new document for the ingress firewall rules, it displays correctly with talosctl edit mc, but the output of talosctl get mc will show the documents after the first YAML doc incorrectly indented, which breaks processing with yq.

The multi-docs are applied correctly by Talos - it is just in display they are mal-formatted.

Logs

e.g. append a YAML document End via editing the machine config thus:

  #       apiVersion: v1
  #       kind: Namespace
  #       metadata:
  #             name: ci
    
... 

and it will show thus via get mc -o yaml

      #       apiVersion: v1
      #       kind: Namespace
      #       metadata:
      #       	name: ci
    
    ...

Environment

  • Talos version: 1.7
  • Kubernetes version: [kubectl version --short]
  • Platform:
  • This happens with talosctl and also omnictl get redactedclustermachineconfig

steverfrancis avatar May 02 '24 02:05 steverfrancis

Yes, this is true. We don't have an easy answer for it, so we need to figure out what to do for it, as it won't an easy answer.

smira avatar May 02 '24 14:05 smira

A workaround for now is to do talosctl read /system/state/config.yaml which will return correct multi-doc YAML

smira avatar May 02 '24 14:05 smira

Decision: Change mc.spec to be a string.

smira avatar Jun 05 '24 16:06 smira

Can we drop the go-yaml fork if we do this?

smira avatar Jun 12 '24 13:06 smira