fix thirdparty API, now the config file of thirdpartyresource also need to group/version instead of version
This commit is contained in:
@@ -36,6 +36,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/latest"
|
||||
"k8s.io/kubernetes/pkg/api/meta"
|
||||
"k8s.io/kubernetes/pkg/api/rest"
|
||||
apiutil "k8s.io/kubernetes/pkg/api/util"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
expapi "k8s.io/kubernetes/pkg/apis/experimental"
|
||||
"k8s.io/kubernetes/pkg/apiserver"
|
||||
@@ -930,7 +931,7 @@ func (m *Master) InstallThirdPartyResource(rsrc *expapi.ThirdPartyResource) erro
|
||||
func (m *Master) thirdpartyapi(group, kind, version string) *apiserver.APIGroupVersion {
|
||||
resourceStorage := thirdpartyresourcedataetcd.NewREST(m.thirdPartyStorage, group, kind)
|
||||
|
||||
apiRoot := makeThirdPartyPath(group)
|
||||
apiRoot := makeThirdPartyPath("")
|
||||
|
||||
storage := map[string]rest.Storage{
|
||||
strings.ToLower(kind) + "s": resourceStorage,
|
||||
@@ -938,10 +939,10 @@ func (m *Master) thirdpartyapi(group, kind, version string) *apiserver.APIGroupV
|
||||
|
||||
return &apiserver.APIGroupVersion{
|
||||
Root: apiRoot,
|
||||
Version: version,
|
||||
Version: apiutil.GetGroupVersion(group, version),
|
||||
APIRequestInfoResolver: m.newAPIRequestInfoResolver(),
|
||||
|
||||
Creater: thirdpartyresourcedata.NewObjectCreator(version, api.Scheme),
|
||||
Creater: thirdpartyresourcedata.NewObjectCreator(group, version, api.Scheme),
|
||||
Convertor: api.Scheme,
|
||||
Typer: api.Scheme,
|
||||
|
||||
|
@@ -681,7 +681,7 @@ func testInstallThirdPartyAPIPostForVersion(t *testing.T, version string) {
|
||||
},
|
||||
TypeMeta: unversioned.TypeMeta{
|
||||
Kind: "Foo",
|
||||
APIVersion: version,
|
||||
APIVersion: "company.com/" + version,
|
||||
},
|
||||
SomeField: "test field",
|
||||
OtherField: 10,
|
||||
|
@@ -30,10 +30,13 @@ import (
|
||||
"k8s.io/kubernetes/pkg/util/sets"
|
||||
)
|
||||
|
||||
const thirdpartyprefix = "/apis/"
|
||||
const thirdpartyprefix = "/apis"
|
||||
|
||||
func makeThirdPartyPath(group string) string {
|
||||
return thirdpartyprefix + group
|
||||
if len(group) == 0 {
|
||||
return thirdpartyprefix
|
||||
}
|
||||
return thirdpartyprefix + "/" + group
|
||||
}
|
||||
|
||||
// resourceInterface is the interface for the parts of the master that know how to add/remove
|
||||
|
Reference in New Issue
Block a user