Allow server and client to take api version as argument

* Defaults to v1beta1
* apiserver takes -storage_version which controls etcd storage version
  and the version of the client used to connect to other apiservers
* Changed signature of client.New to add version parameter
* All controller code and component code prefers the oldest (most common)
  server version
This commit is contained in:
Clayton Coleman
2014-09-11 19:01:29 -04:00
parent ca5355908f
commit 5483333e29
22 changed files with 309 additions and 164 deletions

View File

@@ -150,7 +150,7 @@ func TestSyncEndpointsEmpty(t *testing.T) {
testServer := makeTestServer(t,
serverResponse{http.StatusOK, newPodList(0)},
serverResponse{http.StatusOK, api.ServiceList{}})
client := client.NewOrDie(testServer.URL, nil)
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{}
endpoints := NewEndpointController(&serviceRegistry, client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
@@ -162,7 +162,7 @@ func TestSyncEndpointsError(t *testing.T) {
testServer := makeTestServer(t,
serverResponse{http.StatusOK, newPodList(0)},
serverResponse{http.StatusInternalServerError, api.ServiceList{}})
client := client.NewOrDie(testServer.URL, nil)
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{
Err: fmt.Errorf("test error"),
}
@@ -185,7 +185,7 @@ func TestSyncEndpointsItems(t *testing.T) {
testServer := makeTestServer(t,
serverResponse{http.StatusOK, newPodList(1)},
serverResponse{http.StatusOK, serviceList})
client := client.NewOrDie(testServer.URL, nil)
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{}
endpoints := NewEndpointController(&serviceRegistry, client)
if err := endpoints.SyncServiceEndpoints(); err != nil {
@@ -210,7 +210,7 @@ func TestSyncEndpointsPodError(t *testing.T) {
testServer := makeTestServer(t,
serverResponse{http.StatusInternalServerError, api.PodList{}},
serverResponse{http.StatusOK, serviceList})
client := client.NewOrDie(testServer.URL, nil)
client := client.NewOrDie(testServer.URL, "v1beta1", nil)
serviceRegistry := registrytest.ServiceRegistry{
List: api.ServiceList{
Items: []api.Service{