Skip to content

Commit

Permalink
add svc and netpol to discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Jul 18, 2017
1 parent 8dcedb0 commit 8232778
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/registry/core/service/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ func NewStorage(registry Registry, endpoints endpoint.Registry, serviceIPs ipall
}
}

// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource.
func (rs *REST) ShortNames() []string {
return []string{"svc"}
}

// Categories implements the CategoriesProvider interface. Returns a list of categories a resource is part of.
func (rs *REST) Categories() []string {
return []string{"all"}
}

// TODO: implement includeUninitialized by refactoring this to move to store
func (rs *REST) Create(ctx genericapirequest.Context, obj runtime.Object, includeUninitialized bool) (runtime.Object, error) {
service := obj.(*api.Service)
Expand Down
1 change: 1 addition & 0 deletions pkg/registry/networking/networkpolicy/storage/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library",
"//vendor/k8s.io/apiserver/pkg/registry/rest:go_default_library",
],
)

Expand Down
9 changes: 9 additions & 0 deletions pkg/registry/networking/networkpolicy/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/registry/generic"
genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
"k8s.io/apiserver/pkg/registry/rest"
"k8s.io/kubernetes/pkg/api"
networkingapi "k8s.io/kubernetes/pkg/apis/networking"
"k8s.io/kubernetes/pkg/registry/cachesize"
Expand Down Expand Up @@ -52,3 +53,11 @@ func NewREST(optsGetter generic.RESTOptionsGetter) *REST {

return &REST{store}
}

// Implement ShortNamesProvider
var _ rest.ShortNamesProvider = &REST{}

// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource.
func (r *REST) ShortNames() []string {
return []string{"netpol"}
}

0 comments on commit 8232778

Please sign in to comment.