mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 22:20:18 +00:00
Add ctx to registry interfaces
This commit is contained in:
@@ -24,8 +24,8 @@ import (
|
||||
|
||||
// Registry is an interface for things that know how to store endpoints.
|
||||
type Registry interface {
|
||||
ListEndpoints() (*api.EndpointsList, error)
|
||||
GetEndpoints(name string) (*api.Endpoints, error)
|
||||
WatchEndpoints(labels, fields labels.Selector, resourceVersion uint64) (watch.Interface, error)
|
||||
UpdateEndpoints(e *api.Endpoints) error
|
||||
ListEndpoints(ctx api.Context) (*api.EndpointsList, error)
|
||||
GetEndpoints(ctx api.Context, name string) (*api.Endpoints, error)
|
||||
WatchEndpoints(ctx api.Context, labels, fields labels.Selector, resourceVersion uint64) (watch.Interface, error)
|
||||
UpdateEndpoints(ctx api.Context, e *api.Endpoints) error
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ func NewREST(registry Registry) *REST {
|
||||
|
||||
// Get satisfies the RESTStorage interface.
|
||||
func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
|
||||
return rs.registry.GetEndpoints(id)
|
||||
return rs.registry.GetEndpoints(ctx, id)
|
||||
}
|
||||
|
||||
// List satisfies the RESTStorage interface.
|
||||
@@ -47,13 +47,13 @@ func (rs *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Obj
|
||||
if !label.Empty() || !field.Empty() {
|
||||
return nil, errors.New("label/field selectors are not supported on endpoints")
|
||||
}
|
||||
return rs.registry.ListEndpoints()
|
||||
return rs.registry.ListEndpoints(ctx)
|
||||
}
|
||||
|
||||
// Watch returns Endpoint events via a watch.Interface.
|
||||
// It implements apiserver.ResourceWatcher.
|
||||
func (rs *REST) Watch(ctx api.Context, label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
||||
return rs.registry.WatchEndpoints(label, field, resourceVersion)
|
||||
return rs.registry.WatchEndpoints(ctx, label, field, resourceVersion)
|
||||
}
|
||||
|
||||
// Create satisfies the RESTStorage interface but is unimplemented.
|
||||
|
Reference in New Issue
Block a user