<p>I'd like to know if the client-go library for Kubernetes contains a function that validates if a json/yaml file. Ideally, it would catch errors such as names not being a DNS-1123 compliant or invalid fields specified. It would also be ideal if a list of errors was returned as opposed to the function returning after the first error encountered. </p>

<p>One thought I have tried is doing an exec to call <code>kubectl --validate --dry-run</code> but this does not fully validate a manifest (meaning it's possible to pass here but fail when you actually apply the file). It also stops at the first error. Plus, it would get expensive quickly if you have a list of manifests to go through.</p>

<p>Another option I looked at was here <a href="https://github.com/kubernetes/client-go/issues/193" rel="nofollow noreferrer">Kubernetes GitHub Issue 193</a> but that's not really the appropriate function nor does it do the checks I'm looking for. </p>

<p>Client-go library for Kubernetes contains no validation functions for YAML/JSON configuration files.</p>

<p>But take a look at this <a href="https://github.com/garethr/kubeval" rel="nofollow noreferrer">utiliy</a>, you can use it for validation on a client’s side and also use its code as an example of validation implementation.</p>
