Second step in decoupling the service controller, use the apiserver for writes too.

Addresses #1436 
The client error is being returned all the way back - I'm 99% sure you can check api/errors.IsNotFound() on it.

> On Sep 26, 2014, at 7:17 PM, Daniel Smith <notifications@github.com> wrote:
> 
> In pkg/service/endpoints_controller.go:
> 
> > @@ -72,11 +73,34 @@ func (e *EndpointController) SyncServiceEndpoints() error {
> >  			}
> >  			endpoints[ix] = net.JoinHostPort(pod.CurrentState.PodIP, strconv.Itoa(port))
> >  		}
> > -		// TODO: this is totally broken, we need to compute this and store inside an AtomicUpdate loop.
> > -		err = e.serviceRegistry.UpdateEndpoints(api.NewContext(), &api.Endpoints{
> > -			JSONBase:  api.JSONBase{ID: service.ID},
> > +		currentEndpoints, err := e.client.GetEndpoints(service.ID)
> > +		if err != nil {
> > +			// TODO this is brittle as all get out, refactor the client libraries to return a structured error.
> > +			if strings.Contains(err.Error(), "(404)") {
> argh argh argh :(
> 
> Is it really more than a handful of lines of code to fix the client? @smarterclayton has a bunch of functions that would be good for this in pkg/api/errors.
> 
> I guess I won't block the PR on this, but only if we have a pact that the next person to use a client's error has to fix it.
> 
> —
> Reply to this email directly or view it on GitHub.