apiserver

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 90 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// DefaultPeerEndpointReconcileInterval is the default amount of time for how often
	// the peer endpoint leases are reconciled.
	DefaultPeerEndpointReconcileInterval = 10 * time.Second
	// DefaultPeerEndpointReconcilerTTL is the default TTL timeout for peer endpoint
	// leases on the storage layer
	DefaultPeerEndpointReconcilerTTL = 15 * time.Second
)
View Source
const (
	// IdentityLeaseComponentLabelKey is used to apply a component label to identity lease objects, indicating:
	//   1. the lease is an identity lease (different from leader election leases)
	//   2. which component owns this lease
	IdentityLeaseComponentLabelKey = "apiserver.kubernetes.io/identity"
)

Variables

View Source
var (
	// IdentityLeaseGCPeriod is the interval which the lease GC controller checks for expired leases
	// IdentityLeaseGCPeriod is exposed so integration tests can tune this value.
	IdentityLeaseGCPeriod = 3600 * time.Second
	// IdentityLeaseDurationSeconds is the duration of kube-apiserver lease in seconds
	// IdentityLeaseDurationSeconds is exposed so integration tests can tune this value.
	IdentityLeaseDurationSeconds = 3600
	// IdentityLeaseRenewIntervalPeriod is the interval of kube-apiserver renewing its lease in seconds
	// IdentityLeaseRenewIntervalPeriod is exposed so integration tests can tune this value.
	IdentityLeaseRenewIntervalPeriod = 10 * time.Second

	// LeaseCandidateGCPeriod is the interval which the leasecandidate GC controller checks for expired leases
	// This is exposed so integration tests can tune this value.
	LeaseCandidateGCPeriod = 30 * time.Minute
)

Functions

func BuildAuthorizer

BuildAuthorizer constructs the authorizer. If authorization is not set in s, it returns nil, nil, false, nil

func BuildGenericConfig

func BuildGenericConfig(
	s options.CompletedOptions,
	schemes []*runtime.Scheme,
	resourceConfig *serverstorage.ResourceConfig,
	getOpenAPIDefinitions func(ref openapicommon.ReferenceCallback) map[string]openapicommon.OpenAPIDefinition,
) (
	genericConfig *genericapiserver.Config,
	versionedInformers clientgoinformers.SharedInformerFactory,
	storageFactory *serverstorage.DefaultStorageFactory,
	lastErr error,
)

BuildGenericConfig takes the generic controlplane apiserver options and produces the genericapiserver.Config associated with it. The genericapiserver.Config is often shared between multiple delegated apiservers.

func BuildPeerProxy

func BuildPeerProxy(versionedInformer clientgoinformers.SharedInformerFactory, svm storageversion.Manager,
	proxyClientCertFile string, proxyClientKeyFile string, peerCAFile string, peerAdvertiseAddress reconcilers.PeerAdvertiseAddress,
	apiServerID string, reconciler reconcilers.PeerEndpointLeaseReconciler, serializer runtime.NegotiatedSerializer) (utilpeerproxy.Interface, error)

func CreateAPIExtensionsConfig

func CreateAPIExtensionsConfig(
	kubeAPIServerConfig server.Config,
	kubeInformers informers.SharedInformerFactory,
	pluginInitializers []admission.PluginInitializer,
	commandOptions options.CompletedOptions,
	masterCount int,
	serviceResolver webhook.ServiceResolver,
	authResolverWrapper webhook.AuthenticationInfoResolverWrapper,
) (*apiextensionsapiserver.Config, error)

func CreateAggregatorConfig added in v1.31.0

func CreateAggregatorConfig(
	kubeAPIServerConfig genericapiserver.Config,
	commandOptions options.CompletedOptions,
	externalInformers kubeexternalinformers.SharedInformerFactory,
	serviceResolver aggregatorapiserver.ServiceResolver,
	proxyTransport *http.Transport,
	peerProxy utilpeerproxy.Interface,
	pluginInitializers []admission.PluginInitializer,
) (*aggregatorapiserver.Config, error)

func CreateAggregatorServer added in v1.31.0

func CreatePeerEndpointLeaseReconciler

func CreatePeerEndpointLeaseReconciler(c genericapiserver.Config, storageFactory serverstorage.StorageFactory) (reconcilers.PeerEndpointLeaseReconciler, error)

CreatePeerEndpointLeaseReconciler creates a apiserver endpoint lease reconciliation loop The peer endpoint leases are used to find network locations of apiservers for peer proxy

func CreateProxyTransport added in v1.31.0

func CreateProxyTransport() *http.Transport

CreateProxyTransport creates the dialer infrastructure to connect to the nodes.

func DefaultGenericAPIServicePriorities added in v1.31.0

func DefaultGenericAPIServicePriorities() map[schema.GroupVersion]APIServicePriority

DefaultGenericAPIServicePriorities returns the APIService priorities for generic APIs

Types

type APIServicePriority added in v1.31.0

type APIServicePriority struct {
	// Group indicates the order of the group relative to other groups.
	Group int32
	// Version indicates the relative order of the Version inside of its group.
	Version int32
}

APIServicePriority defines group priority that is used in discovery. This controls group position in the kubectl output.

type CompletedConfig added in v1.31.0

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

CompletedConfig embeds a private pointer that cannot be instantiated outside of this package

func (*CompletedConfig) GenericStorageProviders added in v1.31.0

func (c *CompletedConfig) GenericStorageProviders(discovery discovery.DiscoveryInterface) ([]RESTStorageProvider, error)

GenericStorageProviders returns a set of APIs for a generic control plane. They ought to be a subset of those served by kube-apiserver.

func (CompletedConfig) New added in v1.31.0

func (c CompletedConfig) New(name string, delegationTarget genericapiserver.DelegationTarget) (*Server, error)

New returns a new instance of Master from the given config. Certain config fields will be set to a default value if unset. Certain config fields must be specified, including: KubeletClientConfig

func (*CompletedConfig) NewCoreGenericConfig added in v1.31.0

func (c *CompletedConfig) NewCoreGenericConfig() *corerest.GenericConfig

NewCoreGenericConfig returns a new core rest generic config.

type Config added in v1.31.0

type Config struct {
	Generic *genericapiserver.Config
	Extra
}

Config defines configuration for the master

func CreateConfig added in v1.31.0

func CreateConfig(
	opts options.CompletedOptions,
	genericConfig *genericapiserver.Config,
	versionedInformers clientgoinformers.SharedInformerFactory,
	storageFactory *serverstorage.DefaultStorageFactory,
	serviceResolver aggregatorapiserver.ServiceResolver,
	additionalInitializers []admission.PluginInitializer,
) (
	*Config,
	[]admission.PluginInitializer,
	error,
)

CreateConfig takes the generic controlplane apiserver options and creates a config for the generic Kube APIs out of it.

func (*Config) Complete added in v1.31.0

func (c *Config) Complete() CompletedConfig

type Extra added in v1.31.0

type Extra struct {
	ClusterAuthenticationInfo clusterauthenticationtrust.ClusterAuthenticationInfo

	APIResourceConfigSource serverstorage.APIResourceConfigSource
	StorageFactory          serverstorage.StorageFactory
	EventTTL                time.Duration

	EnableLogsSupport bool
	ProxyTransport    *http.Transport

	// PeerProxy, if not nil, sets proxy transport between kube-apiserver peers for requests
	// that can not be served locally
	PeerProxy utilpeerproxy.Interface
	// PeerEndpointReconcileInterval defines how often the endpoint leases are reconciled in etcd.
	PeerEndpointReconcileInterval time.Duration
	// PeerEndpointLeaseReconciler updates the peer endpoint leases
	PeerEndpointLeaseReconciler peerreconcilers.PeerEndpointLeaseReconciler
	// PeerAdvertiseAddress is the IP for this kube-apiserver which is used by peer apiservers to route a request
	// to this apiserver. This happens in cases where the peer is not able to serve the request due to
	// version skew. If unset, AdvertiseAddress/BindAddress will be used.
	PeerAdvertiseAddress peerreconcilers.PeerAdvertiseAddress

	ServiceAccountIssuer        serviceaccount.TokenGenerator
	ServiceAccountMaxExpiration time.Duration
	ExtendExpiration            bool

	// ServiceAccountIssuerDiscovery
	ServiceAccountIssuerURL        string
	ServiceAccountJWKSURI          string
	ServiceAccountPublicKeysGetter serviceaccount.PublicKeysGetter

	SystemNamespaces []string

	VersionedInformers clientgoinformers.SharedInformerFactory
}

type RESTStorageProvider added in v1.31.0

type RESTStorageProvider interface {
	GroupName() string
	NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, error)
}

RESTStorageProvider is a factory type for REST storage.

type Server added in v1.31.0

type Server struct {
	GenericAPIServer *genericapiserver.GenericAPIServer

	APIResourceConfigSource   serverstorage.APIResourceConfigSource
	RESTOptionsGetter         genericregistry.RESTOptionsGetter
	ClusterAuthenticationInfo clusterauthenticationtrust.ClusterAuthenticationInfo
	VersionedInformers        clientgoinformers.SharedInformerFactory
}

Server is a struct that contains a generic control plane apiserver instance that can be run to start serving the APIs.

func (*Server) InstallAPIs added in v1.31.0

func (s *Server) InstallAPIs(restStorageProviders ...RESTStorageProvider) error

InstallAPIs will install the APIs for the restStorageProviders if they are enabled.

Directories

Path Synopsis
Package options contains flags and options for initializing an apiserver
Package options contains flags and options for initializing an apiserver
Package samples contains two kube-like generic control plane apiserver, one with CRDs (generic) and one without (minimum).
Package samples contains two kube-like generic control plane apiserver, one with CRDs (generic) and one without (minimum).
generic
sample-generic-controlplane is a kube-like generic control plane - with CRDs - with generic Kube native APIs - with aggregation - without the container domain specific APIs.
sample-generic-controlplane is a kube-like generic control plane - with CRDs - with generic Kube native APIs - with aggregation - without the container domain specific APIs.

Jump to

Keyboard shortcuts

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