Fixing the error in registering /v1 api

This commit is contained in:
nikhiljindal 2016-08-15 16:03:08 -07:00
parent 096dd4df50
commit 217d2f57e9
3 changed files with 13 additions and 3 deletions

View File

@ -91,7 +91,9 @@ var userResources = []string{"svc"}
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper {
// 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()
rootScoped := sets.NewString(
"Namespace",
)
// these kinds should be excluded from the list of resources
ignoredKinds := sets.NewString(

View File

@ -18,6 +18,14 @@ package app
import (
"github.com/golang/glog"
// HACK to ensure that rest mapper from pkg/api is registered for groupName="".
// This is required because both pkg/api/install and federation/apis/core/install
// are installing their respective groupMeta at the same groupName.
// federation/apis/core/install has only a subset of resources and hence if it gets registered first, then installation of v1 API fails in pkg/master.
// TODO(nikhiljindal): Fix this by ensuring that pkg/api/install and federation/apis/core/install do not conflict with each other.
_ "k8s.io/kubernetes/pkg/api/install"
"k8s.io/kubernetes/federation/apis/core"
_ "k8s.io/kubernetes/federation/apis/core/install"
"k8s.io/kubernetes/federation/apis/core/v1"

View File

@ -296,10 +296,10 @@ func testCoreResourceList(t *testing.T) {
// Verify namespaces.
found = findResource(apiResourceList.APIResources, "namespaces")
assert.NotNil(t, found)
assert.True(t, found.Namespaced)
assert.False(t, found.Namespaced)
found = findResource(apiResourceList.APIResources, "namespaces/status")
assert.NotNil(t, found)
assert.True(t, found.Namespaced)
assert.False(t, found.Namespaced)
// Verify events.
found = findResource(apiResourceList.APIResources, "events")