Add support for the PostStart event handler.

@lavalamp re strint: What does String() return if the stored value is an
int?  What does Int() return if the stored value is a string?


On Thu, Sep 4, 2014 at 11:06 AM, Daniel Smith <notifications@github.com>
wrote:

> In pkg/kubelet/handlers.go:
>
> > +
> > +// ResolvePort attempts to turn a IntOrString port reference into a concrete port number.
> > +// If portReference has an int value, it is treated as a literal, and simply returns that value.
> > +// If portReference is a string, an attempt is made to find a port with the same name in the container spec.
> > +// If a port with the same name is found, it's ContainerPort value is returned.  If no matching
> > +// port is found, an error is returned.
> > +func ResolvePort(portReference util.IntOrString, container *api.Container) (int, error) {
> > +	if portReference.Kind == util.IntstrInt {
> > +		return portReference.IntVal, nil
> > +	} else {
> > +		portName := portReference.StrVal
> > +		for _, portSpec := range container.Ports {
> > +			if portSpec.Name == portName {
> > +				return portSpec.ContainerPort, nil
> > +			}
> > +		}
>
> Honestly the StrInt thing should have a String() method and an Int()
> method. It just kills me to see this sort of code replicated everywhere.
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/1156/files#r17131243>
> .
>