Add a generic proxier

To proxy traffic to anything that implements ResourceLocation.
Currently, this is only services. This is easily extensible to minions
(would supercede existing mechanism) and pods.
This commit is contained in:
Daniel Smith
2014-08-27 16:10:44 -07:00
parent e4cd06d2b9
commit e2b645ec15
8 changed files with 334 additions and 4 deletions

View File

@@ -179,7 +179,7 @@ func (rs *RegistryStorage) ResourceLocation(id string) (string, error) {
if len(e.Endpoints) == 0 {
return "", fmt.Errorf("no endpoints available for %v", id)
}
return e.Endpoints[rand.Intn(len(e.Endpoints))], nil
return "http://" + e.Endpoints[rand.Intn(len(e.Endpoints))], nil
}
func (rs *RegistryStorage) deleteExternalLoadBalancer(service *api.Service) error {

View File

@@ -291,7 +291,7 @@ func TestServiceRegistryResourceLocation(t *testing.T) {
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
if e, a := "foo:80", location; e != a {
if e, a := "http://foo:80", location; e != a {
t.Errorf("Expected %v, but got %v", e, a)
}
if e, a := "foo", registry.GottenID; e != a {