external versions no longer need reordering

pull/6/head
deads2k 2015-12-17 16:15:15 -05:00
parent 2cd8bff334
commit e2d280a592
5 changed files with 5 additions and 30 deletions

View File

@ -65,18 +65,13 @@ func init() {
} }
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { 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 // 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 // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString() rootScoped := sets.NewString()
ignoredKinds := 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 // InterfacesFor returns the default Codec and ResourceVersioner for a given version

View File

@ -90,11 +90,6 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error {
var userResources = []string{"rc", "svc", "pods", "pvc"} var userResources = []string{"rc", "svc", "pods", "pvc"}
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { 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 // 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 // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString( rootScoped := sets.NewString(
@ -117,7 +112,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper
"ThirdPartyResourceData", "ThirdPartyResourceData",
"ThirdPartyResourceList") "ThirdPartyResourceList")
mapper := api.NewDefaultRESTMapper(worstToBestGroupVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped) mapper := api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped)
// setup aliases for groups of resources // setup aliases for groups of resources
mapper.AddResourceAlias("all", userResources...) mapper.AddResourceAlias("all", userResources...)

View File

@ -87,18 +87,13 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error {
} }
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { 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 // 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 // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString() rootScoped := sets.NewString()
ignoredKinds := 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 // interfacesFor returns the default Codec and ResourceVersioner for a given version

View File

@ -87,18 +87,13 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error {
} }
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { 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 // 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 // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString() rootScoped := sets.NewString()
ignoredKinds := 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 // interfacesFor returns the default Codec and ResourceVersioner for a given version

View File

@ -87,18 +87,13 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error {
} }
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { 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 // 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 // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString() rootScoped := sets.NewString()
ignoredKinds := 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 // interfacesFor returns the default Codec and ResourceVersioner for a given version