apiserver: k8s.io/apiserver/pkg/server/storage Index | Files

package storage

import "k8s.io/apiserver/pkg/server/storage"

Package storage contains the plumbing to setup the etcd storage of the apiserver.


Package Files

doc.go resource_config.go resource_encoding_config.go storage_codec.go storage_factory.go


const AllResources = "*"

func NewStorageCodec Uses

func NewStorageCodec(opts StorageCodecConfig) (runtime.Codec, runtime.GroupVersioner, error)

NewStorageCodec assembles a storage codec for the provided storage media type, the provided serializer, and the requested storage and memory versions.

type APIResourceConfigSource Uses

type APIResourceConfigSource interface {
    VersionEnabled(version schema.GroupVersion) bool
    ResourceEnabled(resource schema.GroupVersionResource) bool
    AnyVersionForGroupEnabled(group string) bool

APIResourceConfigSource is the interface to determine which groups and versions are enabled

type Backend Uses

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 Uses

type DefaultResourceEncodingConfig struct {
    // contains filtered or unexported fields

func NewDefaultResourceEncodingConfig Uses

func NewDefaultResourceEncodingConfig(scheme *runtime.Scheme) *DefaultResourceEncodingConfig

func (*DefaultResourceEncodingConfig) InMemoryEncodingFor Uses

func (o *DefaultResourceEncodingConfig) InMemoryEncodingFor(resource schema.GroupResource) (schema.GroupVersion, error)

func (*DefaultResourceEncodingConfig) SetResourceEncoding Uses

func (o *DefaultResourceEncodingConfig) SetResourceEncoding(resourceBeingStored schema.GroupResource, externalEncodingVersion, internalVersion schema.GroupVersion)

func (*DefaultResourceEncodingConfig) StorageEncodingFor Uses

func (o *DefaultResourceEncodingConfig) StorageEncodingFor(resource schema.GroupResource) (schema.GroupVersion, error)

type DefaultStorageFactory Uses

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 Uses

func NewDefaultStorageFactory(
    config storagebackend.Config,
    defaultMediaType string,
    defaultSerializer runtime.StorageSerializer,
    resourceEncodingConfig ResourceEncodingConfig,
    resourceConfig APIResourceConfigSource,
    specialDefaultResourcePrefixes map[schema.GroupResource]string,
) *DefaultStorageFactory

func (*DefaultStorageFactory) AddCohabitatingResources Uses

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 Uses

func (s *DefaultStorageFactory) AddSerializationChains(encoderDecoratorFn func(runtime.Encoder) runtime.Encoder, decoderDecoratorFn func([]runtime.Decoder) []runtime.Decoder, groupResources ...schema.GroupResource)

func (*DefaultStorageFactory) Backends Uses

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 Uses

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 Uses

func (s *DefaultStorageFactory) ResourcePrefix(groupResource schema.GroupResource) string

func (*DefaultStorageFactory) SetDisableAPIListChunking Uses

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 Uses

func (s *DefaultStorageFactory) SetEtcdLocation(groupResource schema.GroupResource, location []string)

func (*DefaultStorageFactory) SetEtcdPrefix Uses

func (s *DefaultStorageFactory) SetEtcdPrefix(groupResource schema.GroupResource, prefix string)

func (*DefaultStorageFactory) SetResourceEtcdPrefix Uses

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 Uses

func (s *DefaultStorageFactory) SetSerializer(groupResource schema.GroupResource, mediaType string, serializer runtime.StorageSerializer)

func (*DefaultStorageFactory) SetTransformer Uses

func (s *DefaultStorageFactory) SetTransformer(groupResource schema.GroupResource, transformer value.Transformer)

type OverridingResourceEncoding Uses

type OverridingResourceEncoding struct {
    ExternalResourceEncoding schema.GroupVersion
    InternalResourceEncoding schema.GroupVersion

type ResourceConfig Uses

type ResourceConfig struct {
    GroupVersionConfigs map[schema.GroupVersion]bool
    ResourceConfigs     map[schema.GroupVersionResource]bool

func NewResourceConfig Uses

func NewResourceConfig() *ResourceConfig

func (*ResourceConfig) AnyVersionForGroupEnabled Uses

func (o *ResourceConfig) AnyVersionForGroupEnabled(group string) bool

func (*ResourceConfig) DisableAll Uses

func (o *ResourceConfig) DisableAll()

DisableAll disables all group/versions. It does not modify individual resource enablement/disablement.

func (*ResourceConfig) DisableResources Uses

func (o *ResourceConfig) DisableResources(resources ...schema.GroupVersionResource)

func (*ResourceConfig) DisableVersions Uses

func (o *ResourceConfig) DisableVersions(versions ...schema.GroupVersion)

DisableVersions disables the versions entirely.

func (*ResourceConfig) EnableAll Uses

func (o *ResourceConfig) EnableAll()

EnableAll enables all group/versions. It does not modify individual resource enablement/disablement.

func (*ResourceConfig) EnableResources Uses

func (o *ResourceConfig) EnableResources(resources ...schema.GroupVersionResource)

func (*ResourceConfig) EnableVersions Uses

func (o *ResourceConfig) EnableVersions(versions ...schema.GroupVersion)

func (*ResourceConfig) ResourceEnabled Uses

func (o *ResourceConfig) ResourceEnabled(resource schema.GroupVersionResource) bool

func (*ResourceConfig) VersionEnabled Uses

func (o *ResourceConfig) VersionEnabled(version schema.GroupVersion) bool

type ResourceEncodingConfig Uses

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 Uses

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 Uses

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

Package storage imports 15 packages (graph) and is imported by 151 packages. Updated 2019-04-18. Refresh now. Tools for package owners.