Skip to content

fix(config): accept string values for k9s.gpuVendors in the schema - #4298

Open
fjvbn2003 wants to merge 1 commit into
derailed:masterfrom
fjvbn2003:fix-gpuvendors-schema
Open

fjvbn2003 wants to merge 1 commit into
derailed:masterfrom
fjvbn2003:fix-gpuvendors-schema

Conversation

@fjvbn2003

Copy link
Copy Markdown

k9s.gpuVendors is a map[string]string in internal/config/k9s.go
(vendor name -> resource name, e.g. bozo: bozo/gpu), and that is how the
README documents it. The JSON schema (internal/config/json/schemas/k9s.json)
requires every value to be an object with vendor and model, so a config
that follows the README fails validation and k9s logs
k9s config file ... load failed, while a config that follows the schema would
not unmarshal into the Go type. The mismatch has been there since the setting
was added in v0.50.8.

Changes:

  • schema: gpuVendors values are strings;
  • testdata/k9s/cool.yaml: add a gpuVendors entry so TestValidateK9s/happy
    covers it;
  • README config sample: replace three tab-indented comment lines with spaces
    (the tabs make the sample invalid YAML when copied), and remove a stale
    top-level k9s.noIcons line (the setting lives under k9s.ui.noIcons, which
    the sample already shows; the top-level key is not in the schema or the
    K9s struct).

Testing: I did not run go test (the module cache here lacks gojsonschema).
I checked the README sample and testdata/k9s/cool.yaml against the schema
with a small script implementing the draft-07 keywords the schema uses: with
the old schema gpuVendors.bozo fails with "expected object, got string";
with the new schema both files validate.

This PR was written in part with the assistance of generative AI.
This change was drafted with AI assistance and reviewed by me.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant