WIP: First cut at input validation for Kubelet

* Add some util functions for basic validation
* Spec api fields more tightly
* Break a dep from util -> api, so I can do the reverse
* Add functions to validate structures
* Call those functions when running manifests

This does not validate as it unmarshals YAML or JSON because I want to be able
to validate structures that come from other inputs without forcing them to be
YAML.

This does not handle all api structures - I am not familiar wnough with the
rest to spec them this tightly - I hope someone else can do that.

There are a number of open questions, marked "FIXME".  Please offer feedback
or opinions.
The kubelet server has no place to stick such info, that will require more
thought to design.


On Sat, Jun 28, 2014 at 2:00 PM, Daniel Smith <notifications@github.com>
wrote:

> In pkg/kubelet/kubelet.go:
>
> > @@ -726,12 +726,18 @@ func (kl *Kubelet) RunSyncLoop(updateChannel <-chan manifestUpdate, handler Sync
> >  		case <-time.After(kl.SyncFrequency):
> >  		}
> >
> > -		manifests := []api.ContainerManifest{}
> > -		for _, m := range last {
> > -			manifests = append(manifests, m...)
> > +		allManifests := []api.ContainerManifest{}
> > +		for src, manifests := range last {
> > +			for _, m := range manifests {
> > +				if err := api.ValidateManifest(&m); err != nil {
>
> I think our reverse channel is the pod cache polling kubelet's server, but
> I haven't personally touched that code yet so I'm not 100% sure. I'm OK if
> that gets fixed in another change, just means that in the meantime we'll
> have to be on the lookout for users experiencing this in IRC. You could
> also do all the wiring up in a second PR if you wanted.
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/280/files#r14326220>
> .
>