Hi AllWe have a thin layer on top of Kubernetes yaml and we are using github.com/ghodss/yaml to validate it.When i use kubectl with a k8s yaml, i see that kubectl can do a lot more validation then what is possible with a simple yaml parser like the above. For e.g. if the indentation is wrong or unrecognized element, etc.When i use the github.com/ghodss/yaml parser, it silently drops the indentation issues and we dont get the errors untill we have converted it to kubernetes yaml and sent them to the apiserver.From briefly looking at kubectl code, it seems like the kubectl is using swagger schema to do the validation. I am not very familiar with it.My questions are:-- Is swagger schema validation is how kubectl is getting richer validation ?
- Is it possible to get the same level of validation with some other libraries ?
Any pointers would be helpful.Mayank
--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/211e128d-1fe7-4059-a591-6a4a0e4a4d59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
+SIGs CLI and API machinery
On Thu, Apr 6, 2017 at 12:28 AM, <krma...@gmail.com> wrote:Hi AllWe have a thin layer on top of Kubernetes yaml and we are using github.com/ghodss/yaml to validate it.When i use kubectl with a k8s yaml, i see that kubectl can do a lot more validation then what is possible with a simple yaml parser like the above. For e.g. if the indentation is wrong or unrecognized element, etc.When i use the github.com/ghodss/yaml parser, it silently drops the indentation issues and we dont get the errors untill we have converted it to kubernetes yaml and sent them to the apiserver.From briefly looking at kubectl code, it seems like the kubectl is using swagger schema to do the validation. I am not very familiar with it.My questions are:-- Is swagger schema validation is how kubectl is getting richer validation ?Yes.- Is it possible to get the same level of validation with some other libraries ?You mean that you want to be able to invoke what kubectl does as a library?I'd eventually like to see that, as well as other general-purpose kubectl functionality, and it's in the plan:For schema validation specifically, I'd also like to see server-side support:We also need to update the validation logic to use the newer OpenAPI spec:
Any pointers would be helpful.Mayank
--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.