From e2d280a592b06462df1ba6968e7bf3e7476dd128 Mon Sep 17 00:00:00 2001 From: deads2k Date: Thu, 17 Dec 2015 16:15:15 -0500 Subject: [PATCH] external versions no longer need reordering --- .../client-gen/testdata/apis/testgroup/install/install.go | 7 +------ pkg/api/install/install.go | 7 +------ pkg/apis/componentconfig/install/install.go | 7 +------ pkg/apis/extensions/install/install.go | 7 +------ pkg/apis/metrics/install/install.go | 7 +------ 5 files changed, 5 insertions(+), 30 deletions(-) diff --git a/cmd/libs/go2idl/client-gen/testdata/apis/testgroup/install/install.go b/cmd/libs/go2idl/client-gen/testdata/apis/testgroup/install/install.go index 8ce6da33f8..949622afa1 100644 --- a/cmd/libs/go2idl/client-gen/testdata/apis/testgroup/install/install.go +++ b/cmd/libs/go2idl/client-gen/testdata/apis/testgroup/install/install.go @@ -65,18 +65,13 @@ func init() { } func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { - worstToBestGroupVersions := []unversioned.GroupVersion{} - for i := len(externalVersions) - 1; i >= 0; i-- { - worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) - } - // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope rootScoped := sets.NewString() ignoredKinds := sets.NewString() - return api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) } // InterfacesFor returns the default Codec and ResourceVersioner for a given version diff --git a/pkg/api/install/install.go b/pkg/api/install/install.go index d52224916f..4980724425 100644 --- a/pkg/api/install/install.go +++ b/pkg/api/install/install.go @@ -90,11 +90,6 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error { var userResources = []string{"rc", "svc", "pods", "pvc"} func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { - worstToBestGroupVersions := []unversioned.GroupVersion{} - for i := len(externalVersions) - 1; i >= 0; i-- { - worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) - } - // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope rootScoped := sets.NewString( @@ -117,7 +112,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper "ThirdPartyResourceData", "ThirdPartyResourceList") - mapper := api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) + mapper := api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) // setup aliases for groups of resources mapper.AddResourceAlias("all", userResources...) diff --git a/pkg/apis/componentconfig/install/install.go b/pkg/apis/componentconfig/install/install.go index febc3eeec4..6424275edf 100644 --- a/pkg/apis/componentconfig/install/install.go +++ b/pkg/apis/componentconfig/install/install.go @@ -87,18 +87,13 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error { } func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { - worstToBestGroupVersions := []unversioned.GroupVersion{} - for i := len(externalVersions) - 1; i >= 0; i-- { - worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) - } - // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope rootScoped := sets.NewString() ignoredKinds := sets.NewString() - return api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) } // interfacesFor returns the default Codec and ResourceVersioner for a given version diff --git a/pkg/apis/extensions/install/install.go b/pkg/apis/extensions/install/install.go index 9b82a9962d..fd56a5343c 100644 --- a/pkg/apis/extensions/install/install.go +++ b/pkg/apis/extensions/install/install.go @@ -87,18 +87,13 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error { } func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { - worstToBestGroupVersions := []unversioned.GroupVersion{} - for i := len(externalVersions) - 1; i >= 0; i-- { - worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) - } - // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope rootScoped := sets.NewString() ignoredKinds := sets.NewString() - return api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) } // interfacesFor returns the default Codec and ResourceVersioner for a given version diff --git a/pkg/apis/metrics/install/install.go b/pkg/apis/metrics/install/install.go index c74d59260d..6cccf073cd 100644 --- a/pkg/apis/metrics/install/install.go +++ b/pkg/apis/metrics/install/install.go @@ -87,18 +87,13 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error { } func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { - worstToBestGroupVersions := []unversioned.GroupVersion{} - for i := len(externalVersions) - 1; i >= 0; i-- { - worstToBestGroupVersions = append(worstToBestGroupVersions, externalVersions[i]) - } - // the list of kinds that are scoped at the root of the api hierarchy // if a kind is not enumerated here, it is assumed to have a namespace scope rootScoped := sets.NewString() ignoredKinds := sets.NewString() - return api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) + return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) } // interfacesFor returns the default Codec and ResourceVersioner for a given version