Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML output of machine config incorrectly formatted for multidoc configurations #8687

Closed
Tracked by #8484
steverfrancis opened this issue May 2, 2024 · 4 comments · Fixed by #8980
Closed
Tracked by #8484
Assignees

Comments

@steverfrancis
Copy link
Collaborator

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
@smira
Copy link
Member

smira commented May 2, 2024

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
Copy link
Member

smira commented May 2, 2024

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

@smira
Copy link
Member

smira commented Jun 5, 2024

Decision: Change mc.spec to be a string.

@smira
Copy link
Member

smira commented Jun 12, 2024

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

@DmitriyMV DmitriyMV self-assigned this Jun 27, 2024
DmitriyMV added a commit to DmitriyMV/talos that referenced this issue Jul 5, 2024
For `get mc -o json|yaml` we pretend that `spec` field is string and not an actual yaml map. That way you
can see the full spec in unformatted view using `talosctl -n <node> get mc -o yaml` or formatted using
`talosctl -n <node> get mc -o yaml | yq .spec`.

`edit mc` command is unaffected.

Fixes siderolabs#8687

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
DmitriyMV added a commit to DmitriyMV/talos that referenced this issue Jul 8, 2024
For `get mc -o json|yaml` we pretend that `spec` field is string and not an actual yaml map. That way you
can see the full spec in unformatted view using `talosctl -n <node> get mc -o yaml` or formatted using
`talosctl -n <node> get mc -o yaml | yq .spec`.

`edit mc` command is unaffected.

Fixes siderolabs#8687

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
DmitriyMV added a commit to DmitriyMV/talos that referenced this issue Jul 8, 2024
For `get mc -o json|yaml` we pretend that `spec` field is string and not an actual yaml map. That way you
can see the full spec in unformatted view using `talosctl -n <node> get mc -o yaml` or formatted using
`talosctl -n <node> get mc -o yaml | yq .spec`.

`edit mc` command is unaffected.

Fixes siderolabs#8687

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
DmitriyMV added a commit to DmitriyMV/talos that referenced this issue Jul 8, 2024
For `get mc -o json|yaml` we pretend that `spec` field is string and not an actual yaml map. That way you
can see the full spec in unformatted view using `talosctl -n <node> get mc -o yaml` or formatted using
`talosctl -n <node> get mc -o yaml | yq .spec`.

`edit mc` command is unaffected.

Fixes siderolabs#8687

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants