From fc4da6844ea31c0f2efa47728330ec7bc4a32591 Mon Sep 17 00:00:00 2001 From: nikhiljindal Date: Tue, 7 Jul 2015 16:52:38 -0700 Subject: [PATCH] removing references to pre v1beta3 apis --- hack/test-cmd.sh | 15 --------------- pkg/api/meta/restmapper.go | 3 +-- pkg/api/testing/fuzzer.go | 3 ++- pkg/api/unversioned.go | 11 ----------- pkg/client/client_test.go | 11 ++--------- pkg/client/endpoints_test.go | 4 ++-- pkg/client/events.go | 3 --- pkg/client/limit_ranges_test.go | 12 ++++++------ pkg/client/nodes.go | 6 +----- pkg/client/nodes_test.go | 3 +-- pkg/client/persistentvolume_test.go | 12 ++++++------ pkg/client/persistentvolumeclaim_test.go | 12 ++++++------ pkg/client/pod_templates_test.go | 10 +++++----- pkg/client/pods_test.go | 14 +++++++------- pkg/client/replication_controllers_test.go | 8 ++++---- pkg/client/resource_quotas_test.go | 12 ++++++------ pkg/client/services_test.go | 12 ++++++------ pkg/client/testclient/testclient.go | 3 ++- pkg/kubelet/config/common.go | 10 +++------- pkg/master/master.go | 8 -------- 20 files changed, 60 insertions(+), 112 deletions(-) diff --git a/hack/test-cmd.sh b/hack/test-cmd.sh index 2fd0a42046..44c26c150a 100755 --- a/hack/test-cmd.sh +++ b/hack/test-cmd.sh @@ -467,7 +467,6 @@ runTests() { ### Printing pod templates works kubectl get podtemplates "${kube_flags[@]}" - ### Display of an object which doesn't existing in v1beta1 and v1beta2 works [[ "$(kubectl get podtemplates -o yaml "${kube_flags[@]}" | grep nginx)" ]] ### Delete nginx pod template by name @@ -733,20 +732,6 @@ __EOF__ # Post-condition: node is schedulable kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '' - ########### - # Nodes # - ########### - - if [[ "${version}" = "v1beta1" ]] || [[ "${version}" = "v1beta2" ]]; then - kube::log::status "Testing kubectl(${version}:nodes)" - - kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:' - - kube::test::get_object_assert nodes '{{.kind}}' 'List' - - kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:" - fi - ##################### # Retrieve multiple # diff --git a/pkg/api/meta/restmapper.go b/pkg/api/meta/restmapper.go index 512068ee61..6f41bb016b 100644 --- a/pkg/api/meta/restmapper.go +++ b/pkg/api/meta/restmapper.go @@ -66,8 +66,7 @@ type typeMeta struct { // can be mapped with the provided MetadataAccessor and Codec interfaces. // // The resource name of a Kind is defined as the lowercase, -// English-plural version of the Kind string in v1beta3 and onwards, -// and as the camelCase version of the name in v1beta1 and v1beta2. +// English-plural version of the Kind string. // When converting from resource to Kind, the singular version of the // resource name is also accepted for convenience. // diff --git a/pkg/api/testing/fuzzer.go b/pkg/api/testing/fuzzer.go index 40655db85e..3e286cd3d7 100644 --- a/pkg/api/testing/fuzzer.go +++ b/pkg/api/testing/fuzzer.go @@ -23,6 +23,7 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" + "github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered" "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" "github.com/GoogleCloudPlatform/kubernetes/pkg/fields" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" @@ -202,7 +203,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { ev.ValueFrom = &api.EnvVarSource{} ev.ValueFrom.FieldRef = &api.ObjectFieldSelector{} - versions := []string{"v1beta1", "v1beta2", "v1beta3"} + versions := registered.RegisteredVersions ev.ValueFrom.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))] ev.ValueFrom.FieldRef.FieldPath = c.RandString() diff --git a/pkg/api/unversioned.go b/pkg/api/unversioned.go index 86c9bcd07e..cf0d809d99 100644 --- a/pkg/api/unversioned.go +++ b/pkg/api/unversioned.go @@ -35,24 +35,13 @@ type RootPaths struct { Paths []string `json:"paths"` } -// preV1Beta3 returns true if the provided API version is an API introduced before v1beta3. -func PreV1Beta3(version string) bool { - return version == "v1beta1" || version == "v1beta2" -} - // TODO: remove me when watch is refactored func LabelSelectorQueryParam(version string) string { - if PreV1Beta3(version) { - return "labels" - } return "labelSelector" } // TODO: remove me when watch is refactored func FieldSelectorQueryParam(version string) string { - if PreV1Beta3(version) { - return "fields" - } return "fieldSelector" } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 8dd3818a68..9b475cea9c 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -164,15 +164,13 @@ func (c *testClient) ValidateCommon(t *testing.T, err error) { // buildResourcePath is a convenience function for knowing if a namespace should be in a path param or not func buildResourcePath(namespace, resource string) string { if len(namespace) > 0 { - if !(testapi.Version() == "v1beta1" || testapi.Version() == "v1beta2") { - return path.Join("namespaces", namespace, resource) - } + return path.Join("namespaces", namespace, resource) } return resource } // buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not -func buildQueryValues(namespace string, query url.Values) url.Values { +func buildQueryValues(query url.Values) url.Values { v := url.Values{} if query != nil { for key, values := range query { @@ -181,11 +179,6 @@ func buildQueryValues(namespace string, query url.Values) url.Values { } } } - if len(namespace) > 0 { - if api.PreV1Beta3(testapi.Version()) { - v.Set("namespace", namespace) - } - } return v } diff --git a/pkg/client/endpoints_test.go b/pkg/client/endpoints_test.go index 79d592cbc3..4c091cf8a7 100644 --- a/pkg/client/endpoints_test.go +++ b/pkg/client/endpoints_test.go @@ -27,7 +27,7 @@ import ( func TestListEndpoints(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, ""), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, ""), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.EndpointsList{ Items: []api.Endpoints{ @@ -49,7 +49,7 @@ func TestListEndpoints(t *testing.T) { func TestGetEndpoints(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, "endpoint-1"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, "endpoint-1"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "endpoint-1"}}}, } response, err := c.Setup().Endpoints(ns).Get("endpoint-1") diff --git a/pkg/client/events.go b/pkg/client/events.go index 25ff08eb4f..fbaebc465c 100644 --- a/pkg/client/events.go +++ b/pkg/client/events.go @@ -192,8 +192,5 @@ func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, i // Returns the appropriate field label to use for name of the involved object as per the given API version. func getInvolvedObjectNameFieldLabel(version string) string { - if api.PreV1Beta3(version) { - return "involvedObject.id" - } return "involvedObject.name" } diff --git a/pkg/client/limit_ranges_test.go b/pkg/client/limit_ranges_test.go index e4eb1fcebb..79ed6bdd48 100644 --- a/pkg/client/limit_ranges_test.go +++ b/pkg/client/limit_ranges_test.go @@ -57,7 +57,7 @@ func TestLimitRangeCreate(t *testing.T) { Request: testRequest{ Method: "POST", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: limitRange, }, Response: Response{StatusCode: 200, Body: limitRange}, @@ -93,7 +93,7 @@ func TestLimitRangeGet(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: limitRange}, @@ -117,7 +117,7 @@ func TestLimitRangeList(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: limitRangeList}, @@ -150,7 +150,7 @@ func TestLimitRangeUpdate(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: limitRange}, } response, err := c.Setup().LimitRanges(ns).Update(limitRange) @@ -180,7 +180,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: limitRange}, } _, err := c.Setup().LimitRanges(ns).Update(limitRange) @@ -192,7 +192,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) { func TestLimitRangeDelete(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().LimitRanges(ns).Delete("foo") diff --git a/pkg/client/nodes.go b/pkg/client/nodes.go index 02b07881eb..ae9c7ce165 100644 --- a/pkg/client/nodes.go +++ b/pkg/client/nodes.go @@ -49,12 +49,8 @@ func newNodes(c *Client) *nodes { return &nodes{c} } -// resourceName returns node's URL resource name based on resource version. -// Uses "minions" as the URL resource name for v1beta1 and v1beta2. +// resourceName returns node's URL resource name. func (c *nodes) resourceName() string { - if api.PreV1Beta3(c.r.APIVersion()) { - return "minions" - } return "nodes" } diff --git a/pkg/client/nodes_test.go b/pkg/client/nodes_test.go index 7d9810adeb..065aadcf32 100644 --- a/pkg/client/nodes_test.go +++ b/pkg/client/nodes_test.go @@ -44,13 +44,12 @@ func TestListMinions(t *testing.T) { } func TestListMinionsLabels(t *testing.T) { - ns := api.NamespaceNone labelSelectorQueryParamName := api.LabelSelectorQueryParam(testapi.Version()) c := &testClient{ Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getNodesResourceName(), "", ""), - Query: buildQueryValues(ns, url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, Response: Response{ StatusCode: 200, Body: &api.NodeList{ diff --git a/pkg/client/persistentvolume_test.go b/pkg/client/persistentvolume_test.go index d06e56548a..7c37a9aaf6 100644 --- a/pkg/client/persistentvolume_test.go +++ b/pkg/client/persistentvolume_test.go @@ -50,7 +50,7 @@ func TestPersistentVolumeCreate(t *testing.T) { Request: testRequest{ Method: "POST", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", ""), - Query: buildQueryValues("", nil), + Query: buildQueryValues(nil), Body: pv, }, Response: Response{StatusCode: 200, Body: pv}, @@ -79,7 +79,7 @@ func TestPersistentVolumeGet(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), - Query: buildQueryValues("", nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: persistentVolume}, @@ -101,7 +101,7 @@ func TestPersistentVolumeList(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", ""), - Query: buildQueryValues("", nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: persistentVolumeList}, @@ -126,7 +126,7 @@ func TestPersistentVolumeUpdate(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), Query: buildQueryValues("", nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: persistentVolume}, } response, err := c.Setup().PersistentVolumes().Update(persistentVolume) @@ -156,7 +156,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) { Request: testRequest{ Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc") + "/status", - Query: buildQueryValues("", nil)}, + Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: persistentVolume}, } response, err := c.Setup().PersistentVolumes().UpdateStatus(persistentVolume) @@ -165,7 +165,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) { func TestPersistentVolumeDelete(t *testing.T) { c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "foo"), Query: buildQueryValues("", nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().PersistentVolumes().Delete("foo") diff --git a/pkg/client/persistentvolumeclaim_test.go b/pkg/client/persistentvolumeclaim_test.go index 10e3ca70da..a91149b031 100644 --- a/pkg/client/persistentvolumeclaim_test.go +++ b/pkg/client/persistentvolumeclaim_test.go @@ -54,7 +54,7 @@ func TestPersistentVolumeClaimCreate(t *testing.T) { Request: testRequest{ Method: "POST", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: pv, }, Response: Response{StatusCode: 200, Body: pv}, @@ -87,7 +87,7 @@ func TestPersistentVolumeClaimGet(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: persistentVolumeClaim}, @@ -110,7 +110,7 @@ func TestPersistentVolumeClaimList(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: persistentVolumeList}, @@ -139,7 +139,7 @@ func TestPersistentVolumeClaimUpdate(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: persistentVolumeClaim}, } response, err := c.Setup().PersistentVolumeClaims(ns).Update(persistentVolumeClaim) @@ -172,7 +172,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) { Request: testRequest{ Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc") + "/status", - Query: buildQueryValues(ns, nil)}, + Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: persistentVolumeClaim}, } response, err := c.Setup().PersistentVolumeClaims(ns).UpdateStatus(persistentVolumeClaim) @@ -182,7 +182,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) { func TestPersistentVolumeClaimDelete(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().PersistentVolumeClaims(ns).Delete("foo") diff --git a/pkg/client/pod_templates_test.go b/pkg/client/pod_templates_test.go index dc81e42907..012c8e8525 100644 --- a/pkg/client/pod_templates_test.go +++ b/pkg/client/pod_templates_test.go @@ -43,7 +43,7 @@ func TestPodTemplateCreate(t *testing.T) { Request: testRequest{ Method: "POST", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: &podTemplate, }, Response: Response{StatusCode: 200, Body: &podTemplate}, @@ -66,7 +66,7 @@ func TestPodTemplateGet(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: podTemplate}, @@ -92,7 +92,7 @@ func TestPodTemplateList(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: podTemplateList}, @@ -112,7 +112,7 @@ func TestPodTemplateUpdate(t *testing.T) { Template: api.PodTemplateSpec{}, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: podTemplate}, } response, err := c.Setup().PodTemplates(ns).Update(podTemplate) @@ -122,7 +122,7 @@ func TestPodTemplateUpdate(t *testing.T) { func TestPodTemplateDelete(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().PodTemplates(ns).Delete("foo", nil) diff --git a/pkg/client/pods_test.go b/pkg/client/pods_test.go index bb13f8bcf1..18a0021287 100644 --- a/pkg/client/pods_test.go +++ b/pkg/client/pods_test.go @@ -29,7 +29,7 @@ import ( func TestListEmptyPods(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.PodList{}}, } podList, err := c.Setup().Pods(ns).List(labels.Everything(), fields.Everything()) @@ -39,7 +39,7 @@ func TestListEmptyPods(t *testing.T) { func TestListPods(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.PodList{ Items: []api.Pod{ @@ -69,7 +69,7 @@ func TestListPodsLabels(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), - Query: buildQueryValues(ns, url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, Response: Response{ StatusCode: 200, Body: &api.PodList{ @@ -99,7 +99,7 @@ func TestListPodsLabels(t *testing.T) { func TestGetPod(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{ StatusCode: 200, Body: &api.Pod{ @@ -133,7 +133,7 @@ func TestGetPodWithNoName(t *testing.T) { func TestDeletePod(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().Pods(ns).Delete("foo", nil) @@ -154,7 +154,7 @@ func TestCreatePod(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "POST", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(ns, nil), Body: requestPod}, + Request: testRequest{Method: "POST", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil), Body: requestPod}, Response: Response{ StatusCode: 200, Body: requestPod, @@ -180,7 +180,7 @@ func TestUpdatePod(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: requestPod}, } receivedPod, err := c.Setup().Pods(ns).Update(requestPod) diff --git a/pkg/client/replication_controllers_test.go b/pkg/client/replication_controllers_test.go index e8946a9f02..93e78e1716 100644 --- a/pkg/client/replication_controllers_test.go +++ b/pkg/client/replication_controllers_test.go @@ -63,7 +63,7 @@ func TestListControllers(t *testing.T) { func TestGetController(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "GET", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "GET", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{ StatusCode: 200, Body: &api.ReplicationController{ @@ -102,7 +102,7 @@ func TestUpdateController(t *testing.T) { ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{ StatusCode: 200, Body: &api.ReplicationController{ @@ -127,7 +127,7 @@ func TestUpdateController(t *testing.T) { func TestDeleteController(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().ReplicationControllers(ns).Delete("foo") @@ -140,7 +140,7 @@ func TestCreateController(t *testing.T) { ObjectMeta: api.ObjectMeta{Name: "foo"}, } c := &testClient{ - Request: testRequest{Method: "POST", Path: testapi.ResourcePath(getRCResourceName(), ns, ""), Body: requestController, Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "POST", Path: testapi.ResourcePath(getRCResourceName(), ns, ""), Body: requestController, Query: buildQueryValues(nil)}, Response: Response{ StatusCode: 200, Body: &api.ReplicationController{ diff --git a/pkg/client/resource_quotas_test.go b/pkg/client/resource_quotas_test.go index 8874e0e104..c27108c5f4 100644 --- a/pkg/client/resource_quotas_test.go +++ b/pkg/client/resource_quotas_test.go @@ -53,7 +53,7 @@ func TestResourceQuotaCreate(t *testing.T) { Request: testRequest{ Method: "POST", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: resourceQuota, }, Response: Response{StatusCode: 200, Body: resourceQuota}, @@ -85,7 +85,7 @@ func TestResourceQuotaGet(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: resourceQuota}, @@ -109,7 +109,7 @@ func TestResourceQuotaList(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, ""), - Query: buildQueryValues(ns, nil), + Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: resourceQuotaList}, @@ -138,7 +138,7 @@ func TestResourceQuotaUpdate(t *testing.T) { }, } c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: resourceQuota}, } response, err := c.Setup().ResourceQuotas(ns).Update(resourceQuota) @@ -168,7 +168,7 @@ func TestResourceQuotaStatusUpdate(t *testing.T) { Request: testRequest{ Method: "PUT", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc") + "/status", - Query: buildQueryValues(ns, nil)}, + Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: resourceQuota}, } response, err := c.Setup().ResourceQuotas(ns).UpdateStatus(resourceQuota) @@ -178,7 +178,7 @@ func TestResourceQuotaStatusUpdate(t *testing.T) { func TestResourceQuotaDelete(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().ResourceQuotas(ns).Delete("foo") diff --git a/pkg/client/services_test.go b/pkg/client/services_test.go index e9b8093dd2..ac5b6dfb69 100644 --- a/pkg/client/services_test.go +++ b/pkg/client/services_test.go @@ -31,7 +31,7 @@ func TestListServices(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath("services", ns, ""), - Query: buildQueryValues(ns, nil)}, + Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.ServiceList{ Items: []api.Service{ @@ -65,7 +65,7 @@ func TestListServicesLabels(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath("services", ns, ""), - Query: buildQueryValues(ns, url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, + Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})}, Response: Response{StatusCode: 200, Body: &api.ServiceList{ Items: []api.Service{ @@ -100,7 +100,7 @@ func TestGetService(t *testing.T) { Request: testRequest{ Method: "GET", Path: testapi.ResourcePath("services", ns, "1"), - Query: buildQueryValues(ns, nil)}, + Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}}, } response, err := c.Setup().Services(ns).Get("1") @@ -125,7 +125,7 @@ func TestCreateService(t *testing.T) { Method: "POST", Path: testapi.ResourcePath("services", ns, ""), Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}, - Query: buildQueryValues(ns, nil)}, + Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}}, } response, err := c.Setup().Services(ns).Create(&api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}) @@ -136,7 +136,7 @@ func TestUpdateService(t *testing.T) { ns := api.NamespaceDefault svc := &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1", ResourceVersion: "1"}} c := &testClient{ - Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("services", ns, "service-1"), Body: svc, Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("services", ns, "service-1"), Body: svc, Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200, Body: svc}, } response, err := c.Setup().Services(ns).Update(svc) @@ -146,7 +146,7 @@ func TestUpdateService(t *testing.T) { func TestDeleteService(t *testing.T) { ns := api.NamespaceDefault c := &testClient{ - Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("services", ns, "1"), Query: buildQueryValues(ns, nil)}, + Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("services", ns, "1"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: 200}, } err := c.Setup().Services(ns).Delete("1") diff --git a/pkg/client/testclient/testclient.go b/pkg/client/testclient/testclient.go index 2eb93beda9..b0c08d1863 100644 --- a/pkg/client/testclient/testclient.go +++ b/pkg/client/testclient/testclient.go @@ -19,6 +19,7 @@ package testclient import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest" + "github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered" "github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" "github.com/GoogleCloudPlatform/kubernetes/pkg/version" @@ -131,7 +132,7 @@ func (c *Fake) ServerVersion() (*version.Info, error) { func (c *Fake) ServerAPIVersions() (*api.APIVersions, error) { c.Actions = append(c.Actions, FakeAction{Action: "get-apiversions", Value: nil}) - return &api.APIVersions{Versions: []string{"v1beta1", "v1beta2"}}, nil + return &api.APIVersions{Versions: registered.RegisteredVersions}, nil } func (c *Fake) ComponentStatuses() client.ComponentStatusInterface { diff --git a/pkg/kubelet/config/common.go b/pkg/kubelet/config/common.go index c7178ce165..5f73d1d012 100644 --- a/pkg/kubelet/config/common.go +++ b/pkg/kubelet/config/common.go @@ -69,14 +69,10 @@ func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName string) er func getSelfLink(name, namespace string) string { var selfLink string - if api.PreV1Beta3(latest.Version) { - selfLink = fmt.Sprintf("/api/"+latest.Version+"/pods/%s?namespace=%s", name, namespace) - } else { - if len(namespace) == 0 { - namespace = api.NamespaceDefault - } - selfLink = fmt.Sprintf("/api/"+latest.Version+"/pods/namespaces/%s/%s", name, namespace) + if len(namespace) == 0 { + namespace = api.NamespaceDefault } + selfLink = fmt.Sprintf("/api/"+latest.Version+"/pods/namespaces/%s/%s", name, namespace) return selfLink } diff --git a/pkg/master/master.go b/pkg/master/master.go index f07a710361..554f8596e3 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -480,8 +480,6 @@ func (m *Master) init(c *Config) { "replicationControllers": controllerStorage, "services": service.NewStorage(m.serviceRegistry, m.nodeRegistry, m.endpointRegistry, serviceClusterIPAllocator, serviceNodePortAllocator, c.ClusterName), "endpoints": endpointsStorage, - "minions": nodeStorage, - "minions/status": nodeStatusStorage, "nodes": nodeStorage, "nodes/status": nodeStatusStorage, "events": event.NewStorage(eventRegistry), @@ -748,9 +746,6 @@ func (m *Master) defaultAPIGroupVersion() *apiserver.APIGroupVersion { func (m *Master) api_v1beta3() *apiserver.APIGroupVersion { storage := make(map[string]rest.Storage) for k, v := range m.storage { - if k == "minions" || k == "minions/status" { - continue - } storage[strings.ToLower(k)] = v } version := m.defaultAPIGroupVersion() @@ -764,9 +759,6 @@ func (m *Master) api_v1beta3() *apiserver.APIGroupVersion { func (m *Master) api_v1() *apiserver.APIGroupVersion { storage := make(map[string]rest.Storage) for k, v := range m.storage { - if k == "minions" || k == "minions/status" { - continue - } storage[strings.ToLower(k)] = v } version := m.defaultAPIGroupVersion()