Refactor build API and controller

Refactor the build API and validation. Refactor the build controller
to use the upstream cache package where possible. Use watches wherever
possible.
Did you get your answer here?  This is a hard problem and I'm not sure we  can do anything better than polling.


> On Nov 4, 2014, at 3:34 PM, Dan Mace <notifications@github.com> wrote:
> 
> In pkg/build/controller/factory/factory.go:
> 
> > +type BuildControllerFactory struct {
> > +	Client              *osclient.Client
> > +	KubeClient          *kclient.Client
> > +	DockerBuildStrategy *strategy.DockerBuildStrategy
> > +	STIBuildStrategy    *strategy.STIBuildStrategy
> > +}
> > +
> > +func (factory *BuildControllerFactory) Create() *controller.BuildController {
> > +	buildStore := cache.NewStore()
> > +	cache.NewReflector(&buildLW{client: factory.Client}, &buildapi.Build{}, buildStore).Run()
> > +
> > +	buildQueue := cache.NewFIFO()
> > +	cache.NewReflector(&buildLW{client: factory.Client}, &buildapi.Build{}, buildQueue).Run()
> > +
> > +	podQueue := cache.NewFIFO()
> > +	cache.NewPoller(factory.pollPods, 10*time.Second, podQueue).Run()
> @smarterclayton Would something like cadvisor help here? We really need the pod status to stay in sync with their container states to avoid polling here and in the CustomPod controller for deployments.
> 
> —
> Reply to this email directly or view it on GitHub.
>