package etcd3
import "k8s.io/apiserver/pkg/storage/etcd3"
Index ¶
- func Compact(ctx context.Context, client *clientv3.Client, expectVersion, rev int64) (currentVersion, currentRev, compactRev int64, err error)
- func EtcdHealthCheck(data []byte) error
- func New(c *kubernetes.Client, compactor Compactor, codec runtime.Codec, newFunc, newListFunc func() runtime.Object, prefix, resourcePrefix string, groupResource schema.GroupResource, transformer value.Transformer, leaseManagerConfig LeaseManagerConfig, decoder Decoder, versioner storage.Versioner) *store
- func NewCompactor(client *clientv3.Client, compactInterval time.Duration, clock clock.Clock, onClose func()) *compactor
- func NewETCDLatencyTracker(delegate clientv3.KV) clientv3.KV
- func NewStoreWithUnsafeCorruptObjectDeletion(delegate storage.Interface, gr schema.GroupResource) storage.Interface
- func StartCompactorPerEndpoint(client *clientv3.Client, compactInterval time.Duration) *compactor
- func TestOnlySetFatalOnDecodeError(b bool)
- func WithCorruptObjErrorHandlingTransformer(transformer value.Transformer) value.Transformer
- type Compactor
- type Decoder
- func NewDefaultDecoder(codec runtime.Codec, versioner storage.Versioner) Decoder
- func WithCorruptObjErrorHandlingDecoder(decoder Decoder) Decoder
- type LeaseManagerConfig
- type ListErrorAggregator
Functions ¶
func Compact ¶
func Compact(ctx context.Context, client *clientv3.Client, expectVersion, rev int64) (currentVersion, currentRev, compactRev int64, err error)
Compact compacts etcd store and returns current rev. It will return the current Compact time and global revision if no error occurred. Note that CAS fail will not incur any error.
func EtcdHealthCheck ¶
EtcdHealthCheck decodes data returned from etcd /healthz handler. Deprecated: Validate health by passing storagebackend.Config directly to storagefactory.CreateProber.
func New ¶
func New(c *kubernetes.Client, compactor Compactor, codec runtime.Codec, newFunc, newListFunc func() runtime.Object, prefix, resourcePrefix string, groupResource schema.GroupResource, transformer value.Transformer, leaseManagerConfig LeaseManagerConfig, decoder Decoder, versioner storage.Versioner) *store
New returns an etcd3 implementation of storage.Interface.
func NewCompactor ¶
func NewCompactor(client *clientv3.Client, compactInterval time.Duration, clock clock.Clock, onClose func()) *compactor
NewCompactor runs dedicated compactor, that removes old versions of keys from etcd. Prefer calling StartCompactorPerEndpoint as this function doesn't prevent multiple compactors running per single endpoint.
func NewETCDLatencyTracker ¶
NewETCDLatencyTracker returns an implementation of clientv3.KV that times the calls from the specified 'delegate' KV instance in order to track latency incurred.
func NewStoreWithUnsafeCorruptObjectDeletion ¶
func NewStoreWithUnsafeCorruptObjectDeletion(delegate storage.Interface, gr schema.GroupResource) storage.Interface
NewStoreWithUnsafeCorruptObjectDeletion wraps the given store implementation and adds support for unsafe deletion of corrupt objects
func StartCompactorPerEndpoint ¶
StartCompactorPerEndpoint starts a compactor but prevents multiple compactors per client endpoint. Calling the function twice on single endpoint will return the same compactor. Compactor removes old version of keys from etcd. By default, we save the most recent 5 minutes data and compact versions > 5minutes ago. It should be enough for slow watchers and to tolerate burst.
func TestOnlySetFatalOnDecodeError ¶
func TestOnlySetFatalOnDecodeError(b bool)
TestOnlySetFatalOnDecodeError should only be used for cases where decode errors are expected and need to be tested. e.g. conversion webhooks.
func WithCorruptObjErrorHandlingTransformer ¶
func WithCorruptObjErrorHandlingTransformer(transformer value.Transformer) value.Transformer
WithCorruptObjErrorHandlingTransformer decorates the given decoder, it determines if the error returned by the given transformer represents a corrupt object (the data from the storage is untransformable), and then it wraps the error appropriately so the unsafe deleter can determine if the object is a candidate for unsafe deletion
Types ¶
type Compactor ¶
type Compactor interface { CompactRevision() int64 }
type Decoder ¶
type Decoder interface { // Decode decodes value of bytes into object. It will also // set the object resource version to rev. // On success, objPtr would be set to the object. Decode(value []byte, objPtr runtime.Object, rev int64) error // DecodeListItem decodes bytes value in array into object. DecodeListItem(ctx context.Context, data []byte, rev uint64, newItemFunc func() runtime.Object) (runtime.Object, error) }
Decoder is used by the etcd storage implementation to decode transformed data from the storage into an object
func NewDefaultDecoder ¶
NewDefaultDecoder returns the default decoder for etcd3 store
func WithCorruptObjErrorHandlingDecoder ¶
WithCorruptObjErrorHandlingDecoder decorates the given decoder, it determines if the error returned by the given decoder represents a corrupt object (the object is undecodable), and then it wraps the error appropriately so the unsafe deleter can determine if the object is a candidate for unsafe deletion
type LeaseManagerConfig ¶
type LeaseManagerConfig struct { // ReuseDurationSeconds specifies time in seconds that each lease is reused ReuseDurationSeconds int64 // MaxObjectCount specifies how many objects that a lease can attach MaxObjectCount int64 }
LeaseManagerConfig is configuration for creating a lease manager.
func NewDefaultLeaseManagerConfig ¶
func NewDefaultLeaseManagerConfig() LeaseManagerConfig
NewDefaultLeaseManagerConfig creates a LeaseManagerConfig with default values
type ListErrorAggregator ¶
type ListErrorAggregator interface { // Aggregate aggregates the given error from list operation // key: it identifies the given object in the storage. // err: it represents the error the list operation encountered while // retrieving the given object from the storage. // done: true if the aggregation is done and the list operation should // abort, otherwise the list operation will continue Aggregate(key string, err error) bool // Err returns the aggregated error Err() error }
ListErrorAggregator aggregates the error(s) that the LIST operation encounters while retrieving object(s) from the storage
Source Files ¶
compact.go corrupt_obj_deleter.go decoder.go errors.go event.go healthcheck.go latency_tracker.go lease_manager.go logger.go stats.go store.go watcher.go
Directories ¶
Path | Synopsis |
---|---|
pkg/storage/etcd3/metrics | |
pkg/storage/etcd3/preflight | |
pkg/storage/etcd3/testing | |
pkg/storage/etcd3/testing/testingcert | |
pkg/storage/etcd3/testserver |
- Version
- v0.34.0-beta.0
- Published
- Jul 16, 2025
- Platform
- js/wasm
- Imports
- 47 packages
- Last checked
- 8 hours ago –
Tools for package owners.