Skip to content

Commit

Permalink
Fixing the error in registering /v1 api
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiljindal committed Aug 16, 2016
1 parent 096dd4d commit 217d2f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion federation/apis/core/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions federation/cmd/federation-apiserver/app/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions federation/cmd/federation-apiserver/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 217d2f5

Please sign in to comment.