server

package
v1.6.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2017 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Overview

Package server contains the plumbing to create kubernetes-like API server command.

Index

Constants

View Source
const (
	// DefaultLegacyAPIPrefix is where the the legacy APIs will be located.
	DefaultLegacyAPIPrefix = "/api"

	// APIGroupPrefix is where non-legacy API group will be located.
	APIGroupPrefix = "/apis"
)
View Source
const AllResources = "*"

Variables

This section is empty.

Functions

func DefaultBuildHandlerChain

func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) (secure, insecure http.Handler)

func DefaultOpenAPIConfig

func DefaultOpenAPIConfig(getDefinitions openapicommon.GetOpenAPIDefinitions, scheme *runtime.Scheme) *openapicommon.Config

func DefaultSwaggerConfig

func DefaultSwaggerConfig() *swagger.Config

DefaultSwaggerConfig returns a default configuration without WebServiceURL and WebServices set.

func GetNamedCertificateMap

func GetNamedCertificateMap(certs []NamedTLSCert) (map[string]*tls.Certificate, error)

getNamedCertificateMap returns a map of *tls.Certificate by name. It's is suitable for use in tls.Config#NamedCertificates. Returns an error if any of the certs cannot be loaded. Returns nil if len(certs) == 0

func NewRequestInfoResolver

func NewRequestInfoResolver(c *Config) *apirequest.RequestInfoFactory

func NewSelfClientConfig

func NewSelfClientConfig(secureServingInfo *SecureServingInfo, insecureServingInfo *ServingInfo, token string) (*restclient.Config, error)

NewSelfClientConfig returns a clientconfig which can be used to talk to this apiserver.

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 APIGroupInfo

type APIGroupInfo struct {
	GroupMeta apimachinery.GroupMeta
	// Info about the resources in this group. Its a map from version to resource to the storage.
	VersionedResourcesStorageMap map[string]map[string]rest.Storage
	// OptionsExternalVersion controls the APIVersion used for common objects in the
	// schema like api.Status, api.DeleteOptions, and metav1.ListOptions. Other implementors may
	// define a version "v1beta1" but want to use the Kubernetes "v1" internal objects.
	// If nil, defaults to groupMeta.GroupVersion.
	// TODO: Remove this when https://github.com/kubernetes/kubernetes/issues/19018 is fixed.
	OptionsExternalVersion *schema.GroupVersion
	// MetaGroupVersion defaults to "meta.k8s.io/v1" and is the scheme group version used to decode
	// common API implementations like ListOptions. Future changes will allow this to vary by group
	// version (for when the inevitable meta/v2 group emerges).
	MetaGroupVersion *schema.GroupVersion

	// Scheme includes all of the types used by this group and how to convert between them (or
	// to convert objects from outside of this group that are accepted in this API).
	// TODO: replace with interfaces
	Scheme *runtime.Scheme
	// NegotiatedSerializer controls how this group encodes and decodes data
	NegotiatedSerializer runtime.NegotiatedSerializer
	// ParameterCodec performs conversions for query parameters passed to API calls
	ParameterCodec runtime.ParameterCodec

	// SubresourceGroupVersionKind contains the GroupVersionKind overrides for each subresource that is
	// accessible from this API group version. The GroupVersionKind is that of the external version of
	// the subresource. The key of this map should be the path of the subresource. The keys here should
	// match the keys in the Storage map above for subresources.
	SubresourceGroupVersionKind map[string]schema.GroupVersionKind
}

Info about an API group.

func NewDefaultAPIGroupInfo

func NewDefaultAPIGroupInfo(group string, registry *registered.APIRegistrationManager, scheme *runtime.Scheme, parameterCodec runtime.ParameterCodec, codecs serializer.CodecFactory) APIGroupInfo

NewDefaultAPIGroupInfo returns an APIGroupInfo stubbed with "normal" values exposed for easier composition from other packages

type APIResourceConfigSource

type APIResourceConfigSource interface {
	AnyVersionOfResourceEnabled(resource schema.GroupResource) bool
	ResourceEnabled(resource schema.GroupVersionResource) bool
	AllResourcesForVersionEnabled(version schema.GroupVersion) bool
	AnyResourcesForVersionEnabled(version schema.GroupVersion) bool
	AnyResourcesForGroupEnabled(group string) bool
}

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

type Config

type Config struct {
	// SecureServingInfo is required to serve https
	SecureServingInfo *SecureServingInfo

	// LoopbackClientConfig is a config for a privileged loopback connection to the API server
	// This is required for proper functioning of the PostStartHooks on a GenericAPIServer
	LoopbackClientConfig *restclient.Config
	// Authenticator determines which subject is making the request
	Authenticator authenticator.Request
	// Authorizer determines whether the subject is allowed to make the request based only
	// on the RequestURI
	Authorizer authorizer.Authorizer
	// AdmissionControl performs deep inspection of a given request (including content)
	// to set values and determine whether its allowed
	AdmissionControl      admission.Interface
	CorsAllowedOriginList []string

	EnableSwaggerUI bool
	EnableIndex     bool
	EnableProfiling bool
	// Requires generic profiling enabled
	EnableContentionProfiling bool
	EnableMetrics             bool

	// Version will enable the /version endpoint if non-nil
	Version *version.Info
	// AuditWriter is the destination for audit logs.  If nil, they will not be written.
	AuditWriter io.Writer
	// SupportsBasicAuth indicates that's at least one Authenticator supports basic auth
	// If this is true, a basic auth challenge is returned on authentication failure
	// TODO(roberthbailey): Remove once the server no longer supports http basic auth.
	SupportsBasicAuth bool
	// ExternalAddress is the host name to use for external (public internet) facing URLs (e.g. Swagger)
	// Will default to a value based on secure serving info and available ipv4 IPs.
	ExternalAddress string

	// BuildHandlerChainsFunc allows you to build custom handler chains by decorating the apiHandler.
	BuildHandlerChainsFunc func(apiHandler http.Handler, c *Config) (secure, insecure http.Handler)
	// DiscoveryAddresses is used to build the IPs pass to discovery.  If nil, the ExternalAddress is
	// always reported
	DiscoveryAddresses DiscoveryAddresses
	// The default set of healthz checks. There might be more added via AddHealthzChecks dynamically.
	HealthzChecks []healthz.HealthzChecker
	// LegacyAPIGroupPrefixes is used to set up URL parsing for authorization and for validating requests
	// to InstallLegacyAPIGroup.  New API servers don't generally have legacy groups at all.
	LegacyAPIGroupPrefixes sets.String
	// RequestContextMapper maps requests to contexts. Exported so downstream consumers can provider their own mappers
	// TODO confirm that anyone downstream actually uses this and doesn't just need an accessor
	RequestContextMapper apirequest.RequestContextMapper
	// Serializer is required and provides the interface for serializing and converting objects to and from the wire
	// The default (api.Codecs) usually works fine.
	Serializer runtime.NegotiatedSerializer
	// OpenAPIConfig will be used in generating OpenAPI spec. This is nil by default. Use DefaultOpenAPIConfig for "working" defaults.
	OpenAPIConfig *openapicommon.Config
	// SwaggerConfig will be used in generating Swagger spec. This is nil by default. Use DefaultSwaggerConfig for "working" defaults.
	SwaggerConfig *swagger.Config
	// RESTOptionsGetter is used to construct "normal" RESTStorage types
	RESTOptionsGetter genericregistry.RESTOptionsGetter

	// If specified, requests will be allocated a random timeout between this value, and twice this value.
	// Note that it is up to the request handlers to ignore or honor this timeout. In seconds.
	MinRequestTimeout int
	// MaxRequestsInFlight is the maximum number of parallel non-long-running requests. Every further
	// request has to wait. Applies only to non-mutating requests.
	MaxRequestsInFlight int
	// MaxMutatingRequestsInFlight is the maximum number of parallel mutating requests. Every further
	// request has to wait.
	MaxMutatingRequestsInFlight int
	// Predicate which is true for paths of long-running http requests
	LongRunningFunc genericfilters.LongRunningRequestCheck

	// InsecureServingInfo is required to serve http.  HTTP does NOT include authentication or authorization.
	// You shouldn't be using this.  It makes sig-auth sad.
	InsecureServingInfo *ServingInfo

	// The port on PublicAddress where a read-write server will be installed.
	// Defaults to 6443 if not set.
	ReadWritePort int
	// PublicAddress is the IP address where members of the cluster (kubelet,
	// kube-proxy, services, etc.) can reach the GenericAPIServer.
	// If nil or 0.0.0.0, the host's default interface will be used.
	PublicAddress net.IP
}

Config is a structure used to configure a GenericAPIServer. It's members are sorted rougly in order of importance for composers.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values

func (*Config) ApplyClientCert

func (c *Config) ApplyClientCert(clientCAFile string) (*Config, error)

func (*Config) Complete

func (c *Config) Complete() completedConfig

Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.

func (*Config) SkipComplete

func (c *Config) SkipComplete() completedConfig

SkipComplete provides a way to construct a server instance without config completion.

func (*Config) WithSerializer

func (c *Config) WithSerializer(codecs serializer.CodecFactory) *Config

type DefaultDiscoveryAddresses

type DefaultDiscoveryAddresses struct {
	// DiscoveryCIDRRules is a list of CIDRs and Addresses to use if a client is in the range
	DiscoveryCIDRRules []DiscoveryCIDRRule

	// DefaultAddress is the address (hostname or IP and port) that should be used in
	// if no CIDR matches more specifically.
	DefaultAddress string
}

DefaultDiscoveryAddresses is a default implementation of DiscoveryAddresses that will work in most cases

func (DefaultDiscoveryAddresses) ServerAddressByClientCIDRs

func (d DefaultDiscoveryAddresses) ServerAddressByClientCIDRs(clientIP net.IP) []metav1.ServerAddressByClientCIDR

type DefaultResourceEncodingConfig

type DefaultResourceEncodingConfig struct {
	// contains filtered or unexported fields
}

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) *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 (s *DefaultStorageFactory) AddSerializationChains(encoderDecoratorFn func(runtime.Encoder) runtime.Encoder, decoderDecoratorFn func([]runtime.Decoder) []runtime.Decoder, groupResources ...schema.GroupResource)

func (*DefaultStorageFactory) Backends

func (s *DefaultStorageFactory) Backends() []string

Get 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) 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)

type DiscoveryAddresses

type DiscoveryAddresses interface {
	ServerAddressByClientCIDRs(net.IP) []metav1.ServerAddressByClientCIDR
}

type DiscoveryCIDRRule

type DiscoveryCIDRRule struct {
	IPRange net.IPNet

	// Address is the address (hostname or IP and port) that should be used in
	// if this CIDR matches
	Address string
}

DiscoveryCIDRRule is a rule for adding an alternate path to the master based on matching CIDR

func (DiscoveryCIDRRule) ServerAddressByClientCIDRs

func (d DiscoveryCIDRRule) ServerAddressByClientCIDRs(clientIP net.IP) []metav1.ServerAddressByClientCIDR

type GenericAPIServer

type GenericAPIServer struct {

	// LoopbackClientConfig is a config for a privileged loopback connection to the API server
	LoopbackClientConfig *restclient.Config

	// The registered APIs
	HandlerContainer *genericmux.APIContainer

	SecureServingInfo   *SecureServingInfo
	InsecureServingInfo *ServingInfo

	// ExternalAddress is the address (hostname or IP and port) that should be used in
	// external (public internet) URLs for this GenericAPIServer.
	ExternalAddress string

	// Serializer controls how common API objects not in a group/version prefix are serialized for this server.
	// Individual APIGroups may define their own serializers.
	Serializer runtime.NegotiatedSerializer

	// "Outputs"
	Handler         http.Handler
	InsecureHandler http.Handler
	// contains filtered or unexported fields
}

GenericAPIServer contains state for a Kubernetes cluster api server.

func (*GenericAPIServer) AddAPIGroupForDiscovery

func (s *GenericAPIServer) AddAPIGroupForDiscovery(apiGroup metav1.APIGroup)

func (*GenericAPIServer) AddHealthzChecks

func (s *GenericAPIServer) AddHealthzChecks(checks ...healthz.HealthzChecker) error

AddHealthzCheck allows you to add a HealthzCheck.

func (*GenericAPIServer) AddPostStartHook

func (s *GenericAPIServer) AddPostStartHook(name string, hook PostStartHookFunc) error

AddPostStartHook allows you to add a PostStartHook.

func (*GenericAPIServer) DynamicApisDiscovery

func (s *GenericAPIServer) DynamicApisDiscovery() *restful.WebService

DynamicApisDiscovery returns a webservice serving api group discovery. Note: during the server runtime apiGroupsForDiscovery might change.

func (*GenericAPIServer) EffectiveSecurePort

func (s *GenericAPIServer) EffectiveSecurePort() int

EffectiveSecurePort returns the secure port we bound to.

func (*GenericAPIServer) InstallAPIGroup

func (s *GenericAPIServer) InstallAPIGroup(apiGroupInfo *APIGroupInfo) error

Exposes the given api group in the API.

func (*GenericAPIServer) InstallLegacyAPIGroup

func (s *GenericAPIServer) InstallLegacyAPIGroup(apiPrefix string, apiGroupInfo *APIGroupInfo) error

func (*GenericAPIServer) MinRequestTimeout

func (s *GenericAPIServer) MinRequestTimeout() time.Duration

MinRequestTimeout is exposed so that third party resource storage can be build in a different location. TODO refactor third party resource storage

func (*GenericAPIServer) PrepareRun

func (s *GenericAPIServer) PrepareRun() preparedGenericAPIServer

PrepareRun does post API installation setup steps.

func (*GenericAPIServer) RemoveAPIGroupForDiscovery

func (s *GenericAPIServer) RemoveAPIGroupForDiscovery(groupName string)

func (*GenericAPIServer) RequestContextMapper

func (s *GenericAPIServer) RequestContextMapper() apirequest.RequestContextMapper

RequestContextMapper is exposed so that third party resource storage can be build in a different location. TODO refactor third party resource storage

func (*GenericAPIServer) RunPostStartHooks

func (s *GenericAPIServer) RunPostStartHooks()

RunPostStartHooks runs the PostStartHooks for the server

type GroupResourceEncodingConfig

type GroupResourceEncodingConfig struct {
	DefaultExternalEncoding   schema.GroupVersion
	ExternalResourceEncodings map[string]schema.GroupVersion

	DefaultInternalEncoding   schema.GroupVersion
	InternalResourceEncodings map[string]schema.GroupVersion
}

type GroupVersionResourceConfig

type GroupVersionResourceConfig struct {
	// Whether to enable or disable this entire group version.  This dominates any enablement check.
	// Enable=true means the group version is enabled, and EnabledResources/DisabledResources are considered.
	// Enable=false means the group version is disabled, and EnabledResources/DisabledResources are not considered.
	Enable bool

	// DisabledResources lists the resources that are specifically disabled for a group/version
	// DisabledResources trumps EnabledResources
	DisabledResources sets.String

	// EnabledResources lists the resources that should be enabled by default.  This is a little
	// unusual, but we need it for compatibility with old code for now.  An empty set means
	// enable all, a non-empty set means that all other resources are disabled.
	EnabledResources sets.String
}

Specifies the overrides for various API group versions. This can be used to enable/disable entire group versions or specific resources.

func NewGroupVersionResourceConfig

func NewGroupVersionResourceConfig() *GroupVersionResourceConfig

type NamedTLSCert

type NamedTLSCert struct {
	TLSCert tls.Certificate

	// names is a list of domain patterns: fully qualified domain names, possibly prefixed with
	// wildcard segments.
	Names []string
}

type PostStartHookContext

type PostStartHookContext struct {
	// LoopbackClientConfig is a config for a privileged loopback connection to the API server
	LoopbackClientConfig *restclient.Config
}

PostStartHookContext provides information about this API server to a PostStartHookFunc

type PostStartHookFunc

type PostStartHookFunc func(context PostStartHookContext) error

PostStartHookFunc is a function that is called after the server has started. It must properly handle cases like:

  1. asynchronous start in multiple API server processes
  2. conflicts between the different processes all trying to perform the same action
  3. partially complete work (API server crashes while running your hook)
  4. API server access **BEFORE** your hook has completed

Think of it like a mini-controller that is super privileged and gets to run in-process If you use this feature, tag @deads2k on github who has promised to review code for anyone's PostStartHook until it becomes easier to use.

type PostStartHookProvider

type PostStartHookProvider interface {
	PostStartHook() (string, PostStartHookFunc, error)
}

PostStartHookProvider is an interface in addition to provide a post start hook for the api server

type ResourceConfig

type ResourceConfig struct {
	GroupVersionResourceConfigs map[schema.GroupVersion]*GroupVersionResourceConfig
}

func NewResourceConfig

func NewResourceConfig() *ResourceConfig

func (*ResourceConfig) AllResourcesForVersionEnabled

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

func (*ResourceConfig) AnyResourcesForGroupEnabled

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

func (*ResourceConfig) AnyResourcesForVersionEnabled

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

func (*ResourceConfig) AnyVersionOfResourceEnabled

func (o *ResourceConfig) AnyVersionOfResourceEnabled(resource schema.GroupResource) bool

AnyResourcesForVersionEnabled only considers matches based on exactly group/resource lexical matching. This means that resource renames across versions are NOT considered to be the same resource by this method. You'll need to manually check using the ResourceEnabled function.

func (*ResourceConfig) DisableResources

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

func (*ResourceConfig) DisableVersions

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

DisableVersions disables the versions entirely. No resources (even those whitelisted in EnabledResources) will be enabled

func (*ResourceConfig) EnableResources

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

func (*ResourceConfig) EnableVersions

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

func (*ResourceConfig) ResourceEnabled

func (o *ResourceConfig) ResourceEnabled(resource schema.GroupVersionResource) 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 SecureServingInfo

type SecureServingInfo struct {
	ServingInfo

	// Cert is the main server cert which is used if SNI does not match. Cert must be non-nil and is
	// allowed to be in SNICerts.
	Cert *tls.Certificate

	// CACert is an optional certificate authority used for the loopback connection of the Admission controllers.
	// If this is nil, the certificate authority is extracted from Cert or a matching SNI certificate.
	CACert *tls.Certificate

	// SNICerts are the TLS certificates by name used for SNI.
	SNICerts map[string]*tls.Certificate

	// ClientCA is the certificate bundle for all the signers that you'll recognize for incoming client certificates
	ClientCA *x509.CertPool
}

func (*SecureServingInfo) NewSelfClientConfig

func (s *SecureServingInfo) NewSelfClientConfig(token string) (*restclient.Config, error)

type ServingInfo

type ServingInfo struct {
	// BindAddress is the ip:port to serve on
	BindAddress string
	// BindNetwork is the type of network to bind to - defaults to "tcp", accepts "tcp",
	// "tcp4", and "tcp6".
	BindNetwork string
}

func (*ServingInfo) NewSelfClientConfig

func (s *ServingInfo) NewSelfClientConfig(token string) (*restclient.Config, 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() []string
}

StorageFactory is the interface to locate the storage for a given GroupResource

Directories

Path Synopsis
Package filters contains all the http handler chain filters which are not api related.
Package filters contains all the http handler chain filters which are not api related.
Package healthz implements basic http server health checking.
Package healthz implements basic http server health checking.
Package httplog contains a helper object and functions to maintain a log along with an http response.
Package httplog contains a helper object and functions to maintain a log along with an http response.
Package mux contains abstractions for http multiplexing of APIs.
Package mux contains abstractions for http multiplexing of APIs.
Package openapi contains code to generate OpenAPI discovery spec (which initial version of it also known as Swagger 2.0).
Package openapi contains code to generate OpenAPI discovery spec (which initial version of it also known as Swagger 2.0).
package options is the public flags and options used by a generic api server.
package options is the public flags and options used by a generic api server.
Package routes holds a collection of optional genericapiserver http handlers.
Package routes holds a collection of optional genericapiserver http handlers.

Jump to

Keyboard shortcuts

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