k0sctl icon indicating copy to clipboard operation
k0sctl copied to clipboard

Feature Request: JSON Schema to validate k0sctl config

Open vyas-n opened this issue 9 months ago • 3 comments

Hey k0sctl maintainers!

Big fan of the project, I was wondering if you'd be in having a jsonschema (https://json-schema.org/) generated and checked into the repo for the k0sctl.yaml config file.

It has integrations with a lot of tools to validate the structure of the config file and can be used by IDE's for code-completion.

There's a couple of golang libraries / build tools that could generate this for you using the go structs within the codebase: https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=languages&licenses=&languages=&drafts=&toolingTypes=&environments=&showObsolete=false#go

Would this be of interest to implement?

vyas-n avatar Mar 15 '25 17:03 vyas-n

Related issue: https://github.com/k0sproject/k0s/issues/5668

vyas-n avatar Mar 15 '25 17:03 vyas-n

As you mentioned in https://github.com/k0sproject/k0s/issues/5668 - it would be more useful if k0s had a schema and then the k0sctl's schema for spec.k0s.config should somehow adapt to spec.k0s.version (though, it hasn't changed much across versions). The schema tags also need to be defined in rig, which I have done in https://github.com/k0sproject/rig/pull/267 to see what it would be like.

kke avatar May 23 '25 08:05 kke

Would be cool to have the schema support for both k0s and k0sctl, indeed!

twz123 avatar May 23 '25 20:05 twz123