-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration version and kind are not validated #1237
Comments
Also these kind of spelling mistakes go through the validation without any error:
|
That's odd, because the config is read using the strict yaml parser with |
The field validation, btw, if it would work, would say json instead of yaml, because the yaml parser from google converts the yaml to json and the decodes it again (for reasons): |
I don't understand why the field validation does not work. All config loading is done via func ConfigFromString(yml string, dataDir string) (*ClusterConfig, error) {
config := DefaultClusterConfig(dataDir)
err := strictyaml.YamlUnmarshalStrictIgnoringFields([]byte(yml), config, "interval")
if err != nil {
return config, err
}
if config.Spec == nil {
config.Spec = DefaultClusterSpec(dataDir)
}
return config, nil
} The strictyaml thing has tests and it does catch unknown fields. A test like this however fails: func TestUnknownFieldValidation(t *testing.T) {
_, err := ConfigFromString(`
apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
unknown: 1`, dataDir)
assert.Error(t, err)
}
|
Aha! Possibly because of the |
Fixed by #1246 |
The k0s.yaml "header" fields
apiVersion
andkind
are not checked.The text was updated successfully, but these errors were encountered: