Documentation
¶
Overview ¶
Package storage contains the plumbing to setup the etcd storage of the apiserver.
Index ¶
- Constants
- func NewStorageCodec(opts StorageCodecConfig) (runtime.Codec, error)
- type APIResourceConfigSource
- type Backend
- type DefaultResourceEncodingConfig
- func (o *DefaultResourceEncodingConfig) InMemoryEncodingFor(resource schema.GroupResource) (schema.GroupVersion, error)
- func (o *DefaultResourceEncodingConfig) SetResourceEncoding(resourceBeingStored schema.GroupResource, ...)
- func (o *DefaultResourceEncodingConfig) SetVersionEncoding(group string, externalEncodingVersion, internalVersion schema.GroupVersion)
- func (o *DefaultResourceEncodingConfig) StorageEncodingFor(resource schema.GroupResource) (schema.GroupVersion, error)
- type DefaultStorageFactory
- func (s *DefaultStorageFactory) AddCohabitatingResources(groupResources ...schema.GroupResource)
- func (s *DefaultStorageFactory) AddSerializationChains(encoderDecoratorFn func(runtime.Encoder) runtime.Encoder, ...)
- func (s *DefaultStorageFactory) Backends() []Backend
- func (s *DefaultStorageFactory) NewConfig(groupResource schema.GroupResource) (*storagebackend.Config, error)
- func (s *DefaultStorageFactory) ResourcePrefix(groupResource schema.GroupResource) string
- func (s *DefaultStorageFactory) SetDisableAPIListChunking(groupResource schema.GroupResource)
- func (s *DefaultStorageFactory) SetEtcdLocation(groupResource schema.GroupResource, location []string)
- func (s *DefaultStorageFactory) SetEtcdPrefix(groupResource schema.GroupResource, prefix string)
- func (s *DefaultStorageFactory) SetResourceEtcdPrefix(groupResource schema.GroupResource, prefix string)
- func (s *DefaultStorageFactory) SetSerializer(groupResource schema.GroupResource, mediaType string, ...)
- func (s *DefaultStorageFactory) SetTransformer(groupResource schema.GroupResource, transformer value.Transformer)
- type GroupResourceEncodingConfig
- type ResourceConfig
- type ResourceEncodingConfig
- type StorageCodecConfig
- type StorageFactory
Constants ¶
const AllResources = "*"
Variables ¶
This section is empty.
Functions ¶
func NewStorageCodec ¶
func NewStorageCodec(opts StorageCodecConfig) (runtime.Codec, error)
NewStorageCodec assembles a storage codec for the provided storage media type, the provided serializer, and the requested storage and memory versions.
Types ¶
type APIResourceConfigSource ¶
type APIResourceConfigSource interface { VersionEnabled(version schema.GroupVersion) bool AnyVersionForGroupEnabled(group string) bool }
APIResourceConfigSource is the interface to determine which groups and versions are enabled
type Backend ¶ added in v1.7.0
type Backend struct { // the url of storage backend like: https://etcd.domain:2379 Server string // the required tls config TLSConfig *tls.Config }
Backend describes the storage servers, the information here should be enough for health validations.
type DefaultResourceEncodingConfig ¶
type DefaultResourceEncodingConfig struct {
// contains filtered or unexported fields
}
func NewDefaultResourceEncodingConfig ¶
func NewDefaultResourceEncodingConfig(registry *registered.APIRegistrationManager) *DefaultResourceEncodingConfig
func (*DefaultResourceEncodingConfig) InMemoryEncodingFor ¶
func (o *DefaultResourceEncodingConfig) InMemoryEncodingFor(resource schema.GroupResource) (schema.GroupVersion, error)
func (*DefaultResourceEncodingConfig) SetResourceEncoding ¶
func (o *DefaultResourceEncodingConfig) SetResourceEncoding(resourceBeingStored schema.GroupResource, externalEncodingVersion, internalVersion schema.GroupVersion)
func (*DefaultResourceEncodingConfig) SetVersionEncoding ¶
func (o *DefaultResourceEncodingConfig) SetVersionEncoding(group string, externalEncodingVersion, internalVersion schema.GroupVersion)
func (*DefaultResourceEncodingConfig) StorageEncodingFor ¶
func (o *DefaultResourceEncodingConfig) StorageEncodingFor(resource schema.GroupResource) (schema.GroupVersion, error)
type DefaultStorageFactory ¶
type DefaultStorageFactory struct { // StorageConfig describes how to create a storage backend in general. // Its authentication information will be used for every storage.Interface returned. StorageConfig storagebackend.Config Overrides map[schema.GroupResource]groupResourceOverrides DefaultResourcePrefixes map[schema.GroupResource]string // DefaultMediaType is the media type used to store resources. If it is not set, "application/json" is used. DefaultMediaType string // DefaultSerializer is used to create encoders and decoders for the storage.Interface. DefaultSerializer runtime.StorageSerializer // ResourceEncodingConfig describes how to encode a particular GroupVersionResource ResourceEncodingConfig ResourceEncodingConfig // APIResourceConfigSource indicates whether the *storage* is enabled, NOT the API // This is discrete from resource enablement because those are separate concerns. How this source is configured // is left to the caller. APIResourceConfigSource APIResourceConfigSource // contains filtered or unexported fields }
DefaultStorageFactory takes a GroupResource and returns back its storage interface. This result includes: 1. Merged etcd config, including: auth, server locations, prefixes 2. Resource encodings for storage: group,version,kind to store as 3. Cohabitating default: some resources like hpa are exposed through multiple APIs. They must agree on 1 and 2
func NewDefaultStorageFactory ¶
func NewDefaultStorageFactory( config storagebackend.Config, defaultMediaType string, defaultSerializer runtime.StorageSerializer, resourceEncodingConfig ResourceEncodingConfig, resourceConfig APIResourceConfigSource, specialDefaultResourcePrefixes map[schema.GroupResource]string, ) *DefaultStorageFactory
func (*DefaultStorageFactory) AddCohabitatingResources ¶
func (s *DefaultStorageFactory) AddCohabitatingResources(groupResources ...schema.GroupResource)
AddCohabitatingResources links resources together the order of the slice matters! its the priority order of lookup for finding a storage location
func (*DefaultStorageFactory) AddSerializationChains ¶
func (*DefaultStorageFactory) Backends ¶
func (s *DefaultStorageFactory) Backends() []Backend
Backends returns all backends for all registered storage destinations. Used for getting all instances for health validations.
func (*DefaultStorageFactory) NewConfig ¶
func (s *DefaultStorageFactory) NewConfig(groupResource schema.GroupResource) (*storagebackend.Config, error)
New finds the storage destination for the given group and resource. It will return an error if the group has no storage destination configured.
func (*DefaultStorageFactory) ResourcePrefix ¶
func (s *DefaultStorageFactory) ResourcePrefix(groupResource schema.GroupResource) string
func (*DefaultStorageFactory) SetDisableAPIListChunking ¶ added in v1.8.0
func (s *DefaultStorageFactory) SetDisableAPIListChunking(groupResource schema.GroupResource)
SetDisableAPIListChunking allows a specific resource to disable paging at the storage layer, to prevent exposure of key names in continuations. This may be overridden by feature gates.
func (*DefaultStorageFactory) SetEtcdLocation ¶
func (s *DefaultStorageFactory) SetEtcdLocation(groupResource schema.GroupResource, location []string)
func (*DefaultStorageFactory) SetEtcdPrefix ¶
func (s *DefaultStorageFactory) SetEtcdPrefix(groupResource schema.GroupResource, prefix string)
func (*DefaultStorageFactory) SetResourceEtcdPrefix ¶
func (s *DefaultStorageFactory) SetResourceEtcdPrefix(groupResource schema.GroupResource, prefix string)
SetResourceEtcdPrefix sets the prefix for a resource, but not the base-dir. You'll end up in `etcdPrefix/resourceEtcdPrefix`.
func (*DefaultStorageFactory) SetSerializer ¶
func (s *DefaultStorageFactory) SetSerializer(groupResource schema.GroupResource, mediaType string, serializer runtime.StorageSerializer)
func (*DefaultStorageFactory) SetTransformer ¶ added in v1.7.0
func (s *DefaultStorageFactory) SetTransformer(groupResource schema.GroupResource, transformer value.Transformer)
type GroupResourceEncodingConfig ¶
type GroupResourceEncodingConfig struct { DefaultExternalEncoding schema.GroupVersion ExternalResourceEncodings map[string]schema.GroupVersion DefaultInternalEncoding schema.GroupVersion InternalResourceEncodings map[string]schema.GroupVersion }
type ResourceConfig ¶
type ResourceConfig struct {
GroupVersionConfigs map[schema.GroupVersion]bool
}
func NewResourceConfig ¶
func NewResourceConfig() *ResourceConfig
func (*ResourceConfig) AnyVersionForGroupEnabled ¶ added in v1.10.8
func (o *ResourceConfig) AnyVersionForGroupEnabled(group string) bool
func (*ResourceConfig) DisableVersions ¶
func (o *ResourceConfig) DisableVersions(versions ...schema.GroupVersion)
DisableVersions disables the versions entirely.
func (*ResourceConfig) EnableVersions ¶
func (o *ResourceConfig) EnableVersions(versions ...schema.GroupVersion)
func (*ResourceConfig) VersionEnabled ¶ added in v1.10.8
func (o *ResourceConfig) VersionEnabled(version schema.GroupVersion) bool
type ResourceEncodingConfig ¶
type ResourceEncodingConfig interface { // StorageEncoding returns the serialization format for the resource. // TODO this should actually return a GroupVersionKind since you can logically have multiple "matching" Kinds // For now, it returns just the GroupVersion for consistency with old behavior StorageEncodingFor(schema.GroupResource) (schema.GroupVersion, error) // InMemoryEncodingFor returns the groupVersion for the in memory representation the storage should convert to. InMemoryEncodingFor(schema.GroupResource) (schema.GroupVersion, error) }
type StorageCodecConfig ¶
type StorageCodecConfig struct { StorageMediaType string StorageSerializer runtime.StorageSerializer StorageVersion schema.GroupVersion MemoryVersion schema.GroupVersion Config storagebackend.Config EncoderDecoratorFn func(runtime.Encoder) runtime.Encoder DecoderDecoratorFn func([]runtime.Decoder) []runtime.Decoder }
StorageCodecConfig are the arguments passed to newStorageCodecFn
type StorageFactory ¶
type StorageFactory interface { // New finds the storage destination for the given group and resource. It will // return an error if the group has no storage destination configured. NewConfig(groupResource schema.GroupResource) (*storagebackend.Config, error) // ResourcePrefix returns the overridden resource prefix for the GroupResource // This allows for cohabitation of resources with different native types and provides // centralized control over the shape of etcd directories ResourcePrefix(groupResource schema.GroupResource) string // Backends gets all backends for all registered storage destinations. // Used for getting all instances for health validations. Backends() []Backend }
StorageFactory is the interface to locate the storage for a given GroupResource