Skip to content

Don't mask '---' document separator when outputting template #66

Closed

Description

@sabsare

Rationale: Talos has a bunch of options which are given as separate yaml documents
Most useful one (at least for my usecase) is https://www.talos.dev/v1.10/reference/configuration/block/uservolumeconfig which allows to provision and mount additional volumes to a talos machine.

I've build talm myself with upstream talos release

.venvsabsare@jaune cd1 % talm -f nodes/node.yaml version
Client:
        Tag:         v1.10.4
        SHA:         undefined
        Built:       
        Go version:  go1.24.4
        OS/Arch:     darwin/arm64
Server:
        NODE:        172.25.1.6
        Tag:         v1.10.3
        SHA:         dde2cebc
        Built:       
        Go version:  go1.24.3
        OS/Arch:     linux/amd64
        Enabled:     RBAC

And the creation of such documents just by adding

---
apiVersion: v1alpha1
kind: UserVolumeConfig
name: databig
provisioning:
  diskSelector: 
    match: disk.dev_path == '/dev/sdb'
  minSize: 1GB

to the end of a node.yaml file works just as expected.

However
talm template -f nodes/cd1w1.yaml with

{{- $_ := set . "MachineType" "worker" -}}
{{- include "talos.config" . }}
{{- include "volume.config" .}}
{{- define "volume.config" }}
{{ printf "---" }}
apiVersion: v1alpha1
kind: UserVolumeConfig
name: databig
provisioning:
  diskSelector: 
    match: disk.dev_path == '/dev/sdb'
  minSize: 1GB
{{- end }}

does not produce an expected result (version with plain --- was tested as well, as well as defining block in whole @ helpers.tpl)

talm template --debug on the other end outputs correctly

talm apply on edited manualy node manifest works without an issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions