forwardingregistry

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Overview

Package forwardingregistry provides a CRD-like REST storage implementation that can dynamically serve resources based on a given OpenAPI schema, and forward the requests to a KCP workspace-aware delegate client.

It reuses as much as possible from k8s.io/apiextensions-apiserver/pkg/registry/customresource, but replaces the underlying Store, using forwarding rather than access to etcd via genericregistry.Store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvideReadOnlyRestStorage added in v0.8.0

func ProvideReadOnlyRestStorage(ctx context.Context, dynamicClusterClientFunc DynamicClusterClientFunc, wrapper StorageWrapper, identities map[schema.GroupResource]string) (apiserver.RestProviderFunc, error)

ProvideReadOnlyRestStorage returns a commonly used REST storage that forwards calls to a dynamic client, but only for read-only requests.

Types

type CategoriesProviderFunc

type CategoriesProviderFunc func() []string

func (CategoriesProviderFunc) Categories

func (f CategoriesProviderFunc) Categories() []string

type CollectionDeleterFunc

type CollectionDeleterFunc func(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error)

func (CollectionDeleterFunc) DeleteCollection

func (f CollectionDeleterFunc) DeleteCollection(ctx context.Context, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error)

type CreaterFunc

type CreaterFunc func(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error)

func (CreaterFunc) Create

func (f CreaterFunc) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error)

type DestroyerFunc

type DestroyerFunc func()

func (DestroyerFunc) Destroy

func (f DestroyerFunc) Destroy()

type DynamicClusterClientFunc added in v0.11.0

type DynamicClusterClientFunc func(ctx context.Context) (kcpdynamic.ClusterInterface, error)

type FactoryFunc

type FactoryFunc func() runtime.Object

func (FactoryFunc) New

func (f FactoryFunc) New() runtime.Object

type GetterFunc

type GetterFunc func(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)

func (GetterFunc) Get

func (f GetterFunc) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)

type GracefulDeleterFunc

type GracefulDeleterFunc func(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error)

func (GracefulDeleterFunc) Delete

func (f GracefulDeleterFunc) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error)

type ListFactoryFunc

type ListFactoryFunc func() runtime.Object

func (ListFactoryFunc) NewList

func (f ListFactoryFunc) NewList() runtime.Object

type ListerFunc

type ListerFunc func(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error)

func (ListerFunc) List

type ResetFieldsStrategyFunc

type ResetFieldsStrategyFunc func() map[fieldpath.APIVersion]*fieldpath.Set

func (ResetFieldsStrategyFunc) GetResetFields

func (f ResetFieldsStrategyFunc) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set

type StorageWrapper

type StorageWrapper interface {
	Decorate(groupResource schema.GroupResource, storage *StoreFuncs)
}

StorageWrapper allows consumers to wrap the delegating Store in order to add custom behavior around it. For example, a consumer might want to filter the results from the delegated Store, or add impersonation to it.

func WithLabelSelector

func WithLabelSelector(labelSelectorFrom func(ctx context.Context) labels.Requirements) StorageWrapper

func WithStaticLabelSelector

func WithStaticLabelSelector(labelSelector labels.Requirements) StorageWrapper

type StorageWrapperFunc added in v0.10.0

type StorageWrapperFunc func(groupResource schema.GroupResource, storage *StoreFuncs)

func (StorageWrapperFunc) Decorate added in v0.10.0

func (f StorageWrapperFunc) Decorate(groupResource schema.GroupResource, storage *StoreFuncs)

type StorageWrappers added in v0.10.0

type StorageWrappers []StorageWrapper

func (*StorageWrappers) Decorate added in v0.10.0

func (sw *StorageWrappers) Decorate(groupResource schema.GroupResource, storage *StoreFuncs)

type StoreFuncs

StoreFuncs holds proto-functions that can be mutated by successive actors to wrap behavior. Ultimately you can pick and choose which functions to expose in the end, depending on how much of REST storage you need.

func DefaultDynamicDelegatedStoreFuncs

func DefaultDynamicDelegatedStoreFuncs(
	factory FactoryFunc,
	listFactory ListFactoryFunc,
	destroyerFunc DestroyerFunc,
	strategy Strategy,
	tableConvertor rest.TableConvertor,
	resource schema.GroupVersionResource,
	apiExportIdentityHash string,
	categories []string,
	dynamicClusterClientFunc DynamicClusterClientFunc,
	subResources []string,
	patchConflictRetryBackoff wait.Backoff,
	stopWatchesCh <-chan struct{},
) *StoreFuncs

func NewStorage

func NewStorage(
	ctx context.Context,
	resource schema.GroupVersionResource,
	apiExportIdentityHash string,
	kind, listKind schema.GroupVersionKind,
	strategy customresource.CustomResourceStrategy,
	categories []string,
	tableConvertor rest.TableConvertor,
	replicasPathMapping managedfields.ResourcePathMappings,
	dynamicClusterClientFunc DynamicClusterClientFunc,
	patchConflictRetryBackoff *wait.Backoff,
	wrapper StorageWrapper,
) (mainStorage, statusStorage *StoreFuncs)

NewStorage returns a REST storage that forwards calls to a dynamic client.

type Strategy

type Strategy interface {
	rest.RESTCreateStrategy
	rest.ResetFieldsStrategy
}

type TableConvertorFunc

type TableConvertorFunc func(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error)

func (TableConvertorFunc) ConvertToTable

func (f TableConvertorFunc) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error)

type UpdaterFunc

type UpdaterFunc func(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error)

func (UpdaterFunc) Update

func (f UpdaterFunc) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error)

type WatcherFunc

type WatcherFunc func(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)

func (WatcherFunc) Watch

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL