Update registries to use metainternalversion list options
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -51,7 +52,7 @@ func (rs *REST) NewList() runtime.Object {
|
||||
|
||||
// Returns the list of component status. Note that the label and field are both ignored.
|
||||
// Note that this call doesn't support labels or selectors.
|
||||
func (rs *REST) List(ctx genericapirequest.Context, options *api.ListOptions) (runtime.Object, error) {
|
||||
func (rs *REST) List(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
servers := rs.GetServersToValidate()
|
||||
|
||||
wait := sync.WaitGroup{}
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package configmap
|
||||
|
||||
import (
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -26,8 +27,8 @@ import (
|
||||
|
||||
// Registry is an interface for things that know how to store ConfigMaps.
|
||||
type Registry interface {
|
||||
ListConfigMaps(ctx genericapirequest.Context, options *api.ListOptions) (*api.ConfigMapList, error)
|
||||
WatchConfigMaps(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
ListConfigMaps(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ConfigMapList, error)
|
||||
WatchConfigMaps(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
GetConfigMap(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*api.ConfigMap, error)
|
||||
CreateConfigMap(ctx genericapirequest.Context, cfg *api.ConfigMap) (*api.ConfigMap, error)
|
||||
UpdateConfigMap(ctx genericapirequest.Context, cfg *api.ConfigMap) (*api.ConfigMap, error)
|
||||
@@ -45,7 +46,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListConfigMaps(ctx genericapirequest.Context, options *api.ListOptions) (*api.ConfigMapList, error) {
|
||||
func (s *storage) ListConfigMaps(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ConfigMapList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -54,7 +55,7 @@ func (s *storage) ListConfigMaps(ctx genericapirequest.Context, options *api.Lis
|
||||
return obj.(*api.ConfigMapList), err
|
||||
}
|
||||
|
||||
func (s *storage) WatchConfigMaps(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchConfigMaps(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ package controller
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -30,8 +31,8 @@ import (
|
||||
|
||||
// Registry is an interface for things that know how to store ReplicationControllers.
|
||||
type Registry interface {
|
||||
ListControllers(ctx genericapirequest.Context, options *api.ListOptions) (*api.ReplicationControllerList, error)
|
||||
WatchControllers(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
ListControllers(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ReplicationControllerList, error)
|
||||
WatchControllers(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
GetController(ctx genericapirequest.Context, controllerID string, options *metav1.GetOptions) (*api.ReplicationController, error)
|
||||
CreateController(ctx genericapirequest.Context, controller *api.ReplicationController) (*api.ReplicationController, error)
|
||||
UpdateController(ctx genericapirequest.Context, controller *api.ReplicationController) (*api.ReplicationController, error)
|
||||
@@ -49,7 +50,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListControllers(ctx genericapirequest.Context, options *api.ListOptions) (*api.ReplicationControllerList, error) {
|
||||
func (s *storage) ListControllers(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ReplicationControllerList, error) {
|
||||
if options != nil && options.FieldSelector != nil && !options.FieldSelector.Empty() {
|
||||
return nil, fmt.Errorf("field selector not supported yet")
|
||||
}
|
||||
@@ -60,7 +61,7 @@ func (s *storage) ListControllers(ctx genericapirequest.Context, options *api.Li
|
||||
return obj.(*api.ReplicationControllerList), err
|
||||
}
|
||||
|
||||
func (s *storage) WatchControllers(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchControllers(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package endpoint
|
||||
|
||||
import (
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -26,9 +27,9 @@ import (
|
||||
|
||||
// Registry is an interface for things that know how to store endpoints.
|
||||
type Registry interface {
|
||||
ListEndpoints(ctx genericapirequest.Context, options *api.ListOptions) (*api.EndpointsList, error)
|
||||
ListEndpoints(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.EndpointsList, error)
|
||||
GetEndpoints(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*api.Endpoints, error)
|
||||
WatchEndpoints(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
WatchEndpoints(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
UpdateEndpoints(ctx genericapirequest.Context, e *api.Endpoints) error
|
||||
DeleteEndpoints(ctx genericapirequest.Context, name string) error
|
||||
}
|
||||
@@ -44,7 +45,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListEndpoints(ctx genericapirequest.Context, options *api.ListOptions) (*api.EndpointsList, error) {
|
||||
func (s *storage) ListEndpoints(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.EndpointsList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -52,7 +53,7 @@ func (s *storage) ListEndpoints(ctx genericapirequest.Context, options *api.List
|
||||
return obj.(*api.EndpointsList), nil
|
||||
}
|
||||
|
||||
func (s *storage) WatchEndpoints(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchEndpoints(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package namespace
|
||||
|
||||
import (
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -26,8 +27,8 @@ import (
|
||||
|
||||
// Registry is an interface implemented by things that know how to store Namespace objects.
|
||||
type Registry interface {
|
||||
ListNamespaces(ctx genericapirequest.Context, options *api.ListOptions) (*api.NamespaceList, error)
|
||||
WatchNamespaces(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
ListNamespaces(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.NamespaceList, error)
|
||||
WatchNamespaces(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
GetNamespace(ctx genericapirequest.Context, namespaceID string, options *metav1.GetOptions) (*api.Namespace, error)
|
||||
CreateNamespace(ctx genericapirequest.Context, namespace *api.Namespace) error
|
||||
UpdateNamespace(ctx genericapirequest.Context, namespace *api.Namespace) error
|
||||
@@ -45,7 +46,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListNamespaces(ctx genericapirequest.Context, options *api.ListOptions) (*api.NamespaceList, error) {
|
||||
func (s *storage) ListNamespaces(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.NamespaceList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -53,7 +54,7 @@ func (s *storage) ListNamespaces(ctx genericapirequest.Context, options *api.Lis
|
||||
return obj.(*api.NamespaceList), nil
|
||||
}
|
||||
|
||||
func (s *storage) WatchNamespaces(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchNamespaces(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package node
|
||||
|
||||
import (
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -26,12 +27,12 @@ import (
|
||||
|
||||
// Registry is an interface for things that know how to store node.
|
||||
type Registry interface {
|
||||
ListNodes(ctx genericapirequest.Context, options *api.ListOptions) (*api.NodeList, error)
|
||||
ListNodes(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.NodeList, error)
|
||||
CreateNode(ctx genericapirequest.Context, node *api.Node) error
|
||||
UpdateNode(ctx genericapirequest.Context, node *api.Node) error
|
||||
GetNode(ctx genericapirequest.Context, nodeID string, options *metav1.GetOptions) (*api.Node, error)
|
||||
DeleteNode(ctx genericapirequest.Context, nodeID string) error
|
||||
WatchNodes(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
WatchNodes(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
}
|
||||
|
||||
// storage puts strong typing around storage calls
|
||||
@@ -45,7 +46,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListNodes(ctx genericapirequest.Context, options *api.ListOptions) (*api.NodeList, error) {
|
||||
func (s *storage) ListNodes(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.NodeList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -64,7 +65,7 @@ func (s *storage) UpdateNode(ctx genericapirequest.Context, node *api.Node) erro
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *storage) WatchNodes(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchNodes(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package secret
|
||||
|
||||
import (
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -26,8 +27,8 @@ import (
|
||||
|
||||
// Registry is an interface implemented by things that know how to store Secret objects.
|
||||
type Registry interface {
|
||||
ListSecrets(ctx genericapirequest.Context, options *api.ListOptions) (*api.SecretList, error)
|
||||
WatchSecrets(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
ListSecrets(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.SecretList, error)
|
||||
WatchSecrets(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
GetSecret(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*api.Secret, error)
|
||||
CreateSecret(ctx genericapirequest.Context, Secret *api.Secret) (*api.Secret, error)
|
||||
UpdateSecret(ctx genericapirequest.Context, Secret *api.Secret) (*api.Secret, error)
|
||||
@@ -45,7 +46,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListSecrets(ctx genericapirequest.Context, options *api.ListOptions) (*api.SecretList, error) {
|
||||
func (s *storage) ListSecrets(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.SecretList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -53,7 +54,7 @@ func (s *storage) ListSecrets(ctx genericapirequest.Context, options *api.ListOp
|
||||
return obj.(*api.SecretList), nil
|
||||
}
|
||||
|
||||
func (s *storage) WatchSecrets(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchSecrets(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ package service
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -28,12 +29,12 @@ import (
|
||||
|
||||
// Registry is an interface for things that know how to store services.
|
||||
type Registry interface {
|
||||
ListServices(ctx genericapirequest.Context, options *api.ListOptions) (*api.ServiceList, error)
|
||||
ListServices(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ServiceList, error)
|
||||
CreateService(ctx genericapirequest.Context, svc *api.Service) (*api.Service, error)
|
||||
GetService(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*api.Service, error)
|
||||
DeleteService(ctx genericapirequest.Context, name string) error
|
||||
UpdateService(ctx genericapirequest.Context, svc *api.Service) (*api.Service, error)
|
||||
WatchServices(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
WatchServices(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
ExportService(ctx genericapirequest.Context, name string, options metav1.ExportOptions) (*api.Service, error)
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListServices(ctx genericapirequest.Context, options *api.ListOptions) (*api.ServiceList, error) {
|
||||
func (s *storage) ListServices(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ServiceList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -85,7 +86,7 @@ func (s *storage) UpdateService(ctx genericapirequest.Context, svc *api.Service)
|
||||
return obj.(*api.Service), nil
|
||||
}
|
||||
|
||||
func (s *storage) WatchServices(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchServices(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,7 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||
@@ -253,13 +254,13 @@ func (rs *REST) Get(ctx genericapirequest.Context, id string, options *metav1.Ge
|
||||
return rs.registry.GetService(ctx, id, options)
|
||||
}
|
||||
|
||||
func (rs *REST) List(ctx genericapirequest.Context, options *api.ListOptions) (runtime.Object, error) {
|
||||
func (rs *REST) List(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
return rs.registry.ListServices(ctx, options)
|
||||
}
|
||||
|
||||
// Watch returns Services events via a watch.Interface.
|
||||
// It implements rest.Watcher.
|
||||
func (rs *REST) Watch(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (rs *REST) Watch(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return rs.registry.WatchServices(ctx, options)
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package serviceaccount
|
||||
|
||||
import (
|
||||
metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
@@ -26,8 +27,8 @@ import (
|
||||
|
||||
// Registry is an interface implemented by things that know how to store ServiceAccount objects.
|
||||
type Registry interface {
|
||||
ListServiceAccounts(ctx genericapirequest.Context, options *api.ListOptions) (*api.ServiceAccountList, error)
|
||||
WatchServiceAccounts(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error)
|
||||
ListServiceAccounts(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ServiceAccountList, error)
|
||||
WatchServiceAccounts(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
GetServiceAccount(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*api.ServiceAccount, error)
|
||||
CreateServiceAccount(ctx genericapirequest.Context, ServiceAccount *api.ServiceAccount) error
|
||||
UpdateServiceAccount(ctx genericapirequest.Context, ServiceAccount *api.ServiceAccount) error
|
||||
@@ -45,7 +46,7 @@ func NewRegistry(s rest.StandardStorage) Registry {
|
||||
return &storage{s}
|
||||
}
|
||||
|
||||
func (s *storage) ListServiceAccounts(ctx genericapirequest.Context, options *api.ListOptions) (*api.ServiceAccountList, error) {
|
||||
func (s *storage) ListServiceAccounts(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (*api.ServiceAccountList, error) {
|
||||
obj, err := s.List(ctx, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -53,7 +54,7 @@ func (s *storage) ListServiceAccounts(ctx genericapirequest.Context, options *ap
|
||||
return obj.(*api.ServiceAccountList), nil
|
||||
}
|
||||
|
||||
func (s *storage) WatchServiceAccounts(ctx genericapirequest.Context, options *api.ListOptions) (watch.Interface, error) {
|
||||
func (s *storage) WatchServiceAccounts(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
return s.Watch(ctx, options)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user