diff --git a/pkg/platform/registry/cluster/storage/storage.go b/pkg/platform/registry/cluster/storage/storage.go index 9a9bdb519..8fce025b3 100644 --- a/pkg/platform/registry/cluster/storage/storage.go +++ b/pkg/platform/registry/cluster/storage/storage.go @@ -179,7 +179,8 @@ func (r *REST) List(ctx context.Context, options *metainternal.ListOptions) (run // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // Get finds a resource in the storage by name and returns it. diff --git a/pkg/platform/registry/clustercredential/storage/storage.go b/pkg/platform/registry/clustercredential/storage/storage.go index 1c927a26b..914cea86a 100644 --- a/pkg/platform/registry/clustercredential/storage/storage.go +++ b/pkg/platform/registry/clustercredential/storage/storage.go @@ -124,7 +124,8 @@ func (r *REST) List(ctx context.Context, options *metainternal.ListOptions) (run // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // Get finds a resource in the storage by name and returns it. diff --git a/pkg/platform/registry/cronhpa/storage/storage.go b/pkg/platform/registry/cronhpa/storage/storage.go index 715fd383d..e3ed52598 100644 --- a/pkg/platform/registry/cronhpa/storage/storage.go +++ b/pkg/platform/registry/cronhpa/storage/storage.go @@ -24,6 +24,7 @@ import ( metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" genericregistry "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic/registry" "k8s.io/apiserver/pkg/registry/rest" @@ -131,10 +132,17 @@ func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.Va return r.Store.Delete(ctx, name, deleteValidation, options) } +// Watch selects resources in the storage which match to the selector. 'options' can be nil. +func (r *REST) Watch(ctx context.Context, options *metainternal.ListOptions) (watch.Interface, error) { + wrappedOptions := apiserverutil.PredicateListOptions(ctx, options) + return r.Store.Watch(ctx, wrappedOptions) +} + // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // StatusREST implements the REST endpoint for changing the status of a CronHPA. diff --git a/pkg/platform/registry/csioperator/storage/storage.go b/pkg/platform/registry/csioperator/storage/storage.go index 9cf6d5c72..9a3b36900 100644 --- a/pkg/platform/registry/csioperator/storage/storage.go +++ b/pkg/platform/registry/csioperator/storage/storage.go @@ -21,17 +21,17 @@ package storage import ( "context" - apiserverutil "tkestack.io/tke/pkg/apiserver/util" - "tkestack.io/tke/pkg/platform/registry/csioperator" - "tkestack.io/tke/pkg/platform/util" - metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" genericregistry "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic/registry" "k8s.io/apiserver/pkg/registry/rest" "tkestack.io/tke/api/platform" + apiserverutil "tkestack.io/tke/pkg/apiserver/util" + "tkestack.io/tke/pkg/platform/registry/csioperator" + "tkestack.io/tke/pkg/platform/util" "tkestack.io/tke/pkg/util/log" ) @@ -132,10 +132,17 @@ func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.Va return r.Store.Delete(ctx, name, deleteValidation, options) } +// Watch selects resources in the storage which match to the selector. 'options' can be nil. +func (r *REST) Watch(ctx context.Context, options *metainternal.ListOptions) (watch.Interface, error) { + wrappedOptions := apiserverutil.PredicateListOptions(ctx, options) + return r.Store.Watch(ctx, wrappedOptions) +} + // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // StatusREST implements the REST endpoint for changing the status of a LogCollector. diff --git a/pkg/platform/registry/machine/storage/storage.go b/pkg/platform/registry/machine/storage/storage.go index d3fb54c57..280482c87 100644 --- a/pkg/platform/registry/machine/storage/storage.go +++ b/pkg/platform/registry/machine/storage/storage.go @@ -26,6 +26,7 @@ import ( metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" genericregistry "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic/registry" "k8s.io/apiserver/pkg/registry/rest" @@ -247,10 +248,17 @@ func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.Va return r.Store.Delete(ctx, name, deleteValidation, options) } +// Watch selects resources in the storage which match to the selector. 'options' can be nil. +func (r *REST) Watch(ctx context.Context, options *metainternal.ListOptions) (watch.Interface, error) { + wrappedOptions := apiserverutil.PredicateListOptions(ctx, options) + return r.Store.Watch(ctx, wrappedOptions) +} + // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // StatusREST implements the REST endpoint for changing the status of a diff --git a/pkg/platform/registry/persistentevent/storage/storage.go b/pkg/platform/registry/persistentevent/storage/storage.go index 0c3274f89..ac97c361c 100644 --- a/pkg/platform/registry/persistentevent/storage/storage.go +++ b/pkg/platform/registry/persistentevent/storage/storage.go @@ -24,6 +24,7 @@ import ( metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" genericregistry "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic/registry" "k8s.io/apiserver/pkg/registry/rest" @@ -130,10 +131,17 @@ func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.Va return r.Store.Delete(ctx, name, deleteValidation, options) } +// Watch selects resources in the storage which match to the selector. 'options' can be nil. +func (r *REST) Watch(ctx context.Context, options *metainternal.ListOptions) (watch.Interface, error) { + wrappedOptions := apiserverutil.PredicateListOptions(ctx, options) + return r.Store.Watch(ctx, wrappedOptions) +} + // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // StatusREST implements the REST endpoint for changing the status of a replication controller diff --git a/pkg/platform/registry/tappcontroller/storage/storage.go b/pkg/platform/registry/tappcontroller/storage/storage.go index d8ab9e4b8..a3dd7dd1f 100644 --- a/pkg/platform/registry/tappcontroller/storage/storage.go +++ b/pkg/platform/registry/tappcontroller/storage/storage.go @@ -24,6 +24,7 @@ import ( metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" genericregistry "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/generic/registry" "k8s.io/apiserver/pkg/registry/rest" @@ -131,10 +132,17 @@ func (r *REST) Delete(ctx context.Context, name string, deleteValidation rest.Va return r.Store.Delete(ctx, name, deleteValidation, options) } +// Watch selects resources in the storage which match to the selector. 'options' can be nil. +func (r *REST) Watch(ctx context.Context, options *metainternal.ListOptions) (watch.Interface, error) { + wrappedOptions := apiserverutil.PredicateListOptions(ctx, options) + return r.Store.Watch(ctx, wrappedOptions) +} + // DeleteCollection selects all resources in the storage matching given 'listOptions' // and deletes them. func (r *REST) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternal.ListOptions) (runtime.Object, error) { - return r.Store.DeleteCollection(ctx, deleteValidation, options, listOptions) + wrappedOptions := apiserverutil.PredicateListOptions(ctx, listOptions) + return r.Store.DeleteCollection(ctx, deleteValidation, options, wrappedOptions) } // StatusREST implements the REST endpoint for changing the status of a tapp controller.