kvpctl add-ign rejects Butane configs, which Ignition 2.27+ accepts natively

Aperta
#315 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, yaml
Ambito
cli

Direzione di ricerca

Start in cmd/kvpctl/main.go: trace getSubCommand, usage text, and the existing add-ign path that splits and writes KVP values. Check the current tests for that command, then add coverage for YAML parsing and the top-level variant check, including rejection before any key is written. Done means add-butane and add-bu accept valid Butane configs and reject invalid input while add-ign keeps its existing behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Ignition (since 2.27.0) accepts Butane YAML as a config and transpiles it at boot (coreos/ignition#2235). Fedora CoreOS stable ships it as of 44.20260928.3.1. On Hyper-V, the config reaches Ignition through the ignition.config.N KVP keys that kvpctl add-ign writes, so a Butane file could go to the VM directly.

add-ign refuses one before splitting it:

> kvpctl MACHINE add-ign butane.bu
KVP failed: invalid JSON format: invalid character '#' looking for beginning of value

The check was added for #187 (Add JSON formatting check to the add-ign function), when Ignition only read JSON.

The workaround is kvpctl put once per key, with the file cut by hand into 990-byte slices (ginsu.KvpValueMaxLen). Each slice also has to survive being passed as a command-line argument: Windows PowerShell 5.1 drops unescaped embedded double quotes when it calls a native program, and Butane files usually contain some in their inline file contents.

Proposal: a new subcommand, add-butane, with add-bu as an alias. It splits and writes the file exactly as add-ign does, but validates it as a Butane config, not as JSON:

  • the file parses as YAML
  • it has a top-level variant key, the field that marks a Butane config

add-ign and its JSON check from #187 stay as they are, so nothing changes for existing callers. A file that is neither JSON nor Butane still fails before any key is written, which is what #187 set out to catch.

In cmd/kvpctl/main.go, the alias is one more case in getSubCommand mapping add-bu to add-butane, plus one line in the usage text:

Usage: kvpctl <vm name> (get|add|add-ign|add-butane|rm|edit|put|clear) [<key>] [<value>]

	add-butane = split and add key-value pairs for a Butane config (alias: add-bu)

The YAML parse needs a YAML library, which kvpctl doesn't import today. sigs.k8s.io/yaml or gopkg.in/yaml.v3 would do; the check only reads one top-level key.

Environment: kvpctl v0.11.0, Fedora CoreOS 44.20260928.3.1 (Ignition 2.27.0), Hyper-V Gen2 VM.

Lingua principale
Go
Stelle
44
Fork
18
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di containers/libhvee

Tutte le issue di containers/libhvee

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.