kairos-io / kairos

:penguin: The immutable Linux meta-distribution for edge Kubernetes.
https://kairos.io
Apache License 2.0
1.08k stars 94 forks source link

:bug: Users validation warning #988

Open mauromorales opened 1 year ago

mauromorales commented 1 year ago

The validator is currently warning about this config

#node-config

stages:
   initramfs:
     - name: "Set user and password"
       users:
        kairos:
          passwd: "kairos"
       hostname: kairos-{{ trunc 4 .Random }}

With the message

 WARNING: jsonschema: '' does not validate with file:///home/kairos/schema.json#/required: missing properties: 'users'

This is because the current schema expects users to be defined at the root level.

mauromorales commented 1 year ago

@mudler why is it possible to define the users in the different stages?

With the current way, I build the schema validation, it will be possible to check every place where the users can be defined, but, it might make the schema very hard to read. So, if we have to support such scenarios in multiple stages, I'm thinking I'll have to add a second tier of validations, so I can keep the schema a bit more simple. However, my main desire to keep everything on a JSON schema, is that any other tool can read it and ensure validation on their own, i.e., there's no hidden magic or need to dig into the code. WDYT?

mauromorales commented 1 year ago

Ok, Itxaka explained this a bit more in detail, so it's clear I have to support it. I will think about those two options and come back with more info to share with the team and get some feedback