From cb413eb80b4e73d20c8d0d64dbe159ce7482a72a Mon Sep 17 00:00:00 2001 From: Fabiano Franz Date: Tue, 21 Nov 2017 20:54:56 -0200 Subject: [PATCH] UPSTREAM: 49128: add svc and netpol to discovery --- .../kubernetes/pkg/registry/core/service/rest.go | 10 ++++++++++ .../registry/networking/networkpolicy/storage/BUILD | 1 + .../networking/networkpolicy/storage/storage.go | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/vendor/k8s.io/kubernetes/pkg/registry/core/service/rest.go b/vendor/k8s.io/kubernetes/pkg/registry/core/service/rest.go index a369708579d7..dc4e207da571 100644 --- a/vendor/k8s.io/kubernetes/pkg/registry/core/service/rest.go +++ b/vendor/k8s.io/kubernetes/pkg/registry/core/service/rest.go @@ -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) diff --git a/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/BUILD b/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/BUILD index 14dcaa60879a..616452a56cb0 100644 --- a/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/BUILD +++ b/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/BUILD @@ -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", ], ) diff --git a/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/storage.go b/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/storage.go index 48823519c2d5..30489d8a0ab6 100644 --- a/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/storage.go +++ b/vendor/k8s.io/kubernetes/pkg/registry/networking/networkpolicy/storage/storage.go @@ -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/networking/networkpolicy" @@ -50,3 +51,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"} +}