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.
I never said "no more comments" ?  Please, comments.

As we have implemented it, any port listed in Ports[] will have a host
port.  All host ports turn up on the main interface of the VM.  IP per pod
doesn't apply to published ports because we don't have a way to support
that in GCE.


On Mon, Jun 30, 2014 at 11:33 AM, Daniel Smith <notifications@github.com>
wrote:

> In pkg/api/validation.go:
>
> > +		if len(mnt.MountPath) == 0 {
> > +			// Backwards compat.
> > +			if len(mnt.Path) == 0 {
> > +				return fmt.Errorf("VolumeMount.MountPath is missing")
> > +			}
> > +			glog.Warning("DEPRECATED: VolumeMount.Path has been replaced by VolumeMount.MountPath")
> > +			mnt.MountPath = mnt.Path
> > +			mnt.Path = ""
> > +		}
> > +	}
> > +	return nil
> > +}
> > +
> > +func validatePorts(ports []Port) error {
> > +	allNames := util.StringSet{}
> > +	allHostPorts := make(map[int]bool)
>
> (This is not a parenthetical, not a comment, because you asked for no more
> comments: I'm a bit confused because IP-per-pod is the thing that causes
> problems when containers within the pod expose conflicting ports? Also I
> thought IP-per-pod was implemented by our k8s--net... container?)
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/280/files#r14366907>
> .
>