apiserverk8s.io/apiserver/pkg/registry/generic Index | Files | Directories

package generic

import "k8s.io/apiserver/pkg/registry/generic"

Package generic provides a generic object store interface and a generic label/field matching type.

Index

Functions

func AddObjectMetaFieldsSet

func AddObjectMetaFieldsSet(source fields.Set, objectMeta *metav1.ObjectMeta, hasNamespaceField bool) fields.Set

AdObjectMetaField add fields that represent the ObjectMeta to source.

func MergeFieldsSets

func MergeFieldsSets(source fields.Set, fragment fields.Set) fields.Set

MergeFieldsSets merges a fields'set from fragment into the source.

func NewRawStorage

func NewRawStorage(config *storagebackend.ConfigForResource, newFunc, newListFunc func() runtime.Object, resourcePrefix string) (storage.Interface, factory.DestroyFunc, error)

NewRawStorage creates the low level kv storage. This is a work-around for current two layer of same storage interface. TODO: Once cacher is enabled on all registries (event registry is special), we will remove this method.

func ObjectMetaFieldsSet

func ObjectMetaFieldsSet(objectMeta *metav1.ObjectMeta, hasNamespaceField bool) fields.Set

ObjectMetaFieldsSet returns a fields that represent the ObjectMeta.

func UndecoratedStorage

func UndecoratedStorage(
	config *storagebackend.ConfigForResource,
	resourcePrefix string,
	keyFunc func(obj runtime.Object) (string, error),
	newFunc func() runtime.Object,
	newListFunc func() runtime.Object,
	getAttrsFunc storage.AttrFunc,
	trigger storage.IndexerFuncs,
	indexers *cache.Indexers) (storage.Interface, factory.DestroyFunc, error)

UndecoratedStorage returns the given a new storage from the given config without any decoration.

Types

type RESTOptions

type RESTOptions struct {
	StorageConfig *storagebackend.ConfigForResource
	Decorator     StorageDecorator

	EnableGarbageCollection   bool
	DeleteCollectionWorkers   int
	ResourcePrefix            string
	CountMetricPollPeriod     time.Duration
	StorageObjectCountTracker flowcontrolrequest.StorageObjectCountTracker
}

RESTOptions is set of resource-specific configuration options to generic registries.

func (RESTOptions) GetRESTOptions

func (opts RESTOptions) GetRESTOptions(schema.GroupResource, runtime.Object) (RESTOptions, error)

Implement RESTOptionsGetter so that RESTOptions can directly be used when available (i.e. tests)

type RESTOptionsGetter

type RESTOptionsGetter interface {
	// GetRESTOptions returns the RESTOptions for the given resource and example object.
	// The example object is used to determine the storage version for the resource.
	// If the example object is nil, the storage version will be determined by the resource's default storage version.
	GetRESTOptions(resource schema.GroupResource, example runtime.Object) (RESTOptions, error)
}

type StorageDecorator

type StorageDecorator func(
	config *storagebackend.ConfigForResource,
	resourcePrefix string,
	keyFunc func(obj runtime.Object) (string, error),
	newFunc func() runtime.Object,
	newListFunc func() runtime.Object,
	getAttrsFunc storage.AttrFunc,
	trigger storage.IndexerFuncs,
	indexers *cache.Indexers) (storage.Interface, factory.DestroyFunc, error)

StorageDecorator is a function signature for producing a storage.Interface and an associated DestroyFunc from given parameters.

type StoreOptions

type StoreOptions struct {
	RESTOptions RESTOptionsGetter
	TriggerFunc storage.IndexerFuncs
	AttrFunc    storage.AttrFunc
	Indexers    *cache.Indexers
}

StoreOptions is set of configuration options used to complete generic registries.

Source Files

doc.go matcher.go options.go storage_decorator.go

Directories

PathSynopsis
pkg/registry/generic/registryPackage etcd has a generic implementation of a registry that stores things in etcd.
pkg/registry/generic/restPackage rest has generic implementations of resources used for REST responses
pkg/registry/generic/testing
Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
45 minutes ago

Tools for package owners.