controlplane

package
v0.2.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 31 Imported by: 0

README

controlplane

kube-apiserver 风格的 HTTP 服务器应用基座

Documentation

Overview

Package controlplane contains code for setting up and running a OneX control plane API server.

Index

Constants

View Source
const (
	// DefaultEndpointReconcilerInterval is the default amount of time for how often the endpoints for
	// the kubernetes Service are reconciled.
	DefaultEndpointReconcilerInterval = 10 * time.Second
	// DefaultEndpointReconcilerTTL is the default TTL timeout for the storage layer
	DefaultEndpointReconcilerTTL = 15 * time.Second
	// 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"
	// KubeAPIServer defines variable used internally when referring to kube-apiserver component
	KubeAPIServer = "kube-apiserver"
	// KubeAPIServerIdentityLeaseLabelSelector selects kube-apiserver identity leases
	KubeAPIServerIdentityLeaseLabelSelector = IdentityLeaseComponentLabelKey + "=" + KubeAPIServer
)

Variables

This section is empty.

Functions

func AddStableAPIGroupVersionsEnabledByDefault

func AddStableAPIGroupVersionsEnabledByDefault(versions ...schema.GroupVersion)

func DefaultAPIResourceConfigSource

func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig

DefaultAPIResourceConfigSource returns which groupVersion enabled and its resources enabled/disabled.

Types

type CompletedConfig

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

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

func (CompletedConfig) New

func (c CompletedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*Instance, error)

New returns a new instance of APIServer from the given config. Certain config fields will be set to a default value if unset.

type Config

type Config struct {
	GenericConfig *genericapiserver.RecommendedConfig
	ExtraConfig   ExtraConfig
}

Config defines configuration for the onex-apiserver.

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.

type ExternalSharedInformerFactory

type ExternalSharedInformerFactory interface {
	// Start initializes all requested informers. They are handled in goroutines
	// which run until the stop channel gets closed.
	Start(stopCh <-chan struct{})
	// WaitForCacheSync blocks until all started informers' caches were synced
	// or the stop channel gets closed.
	WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
}

type ExtraConfig

type ExtraConfig struct {
	// Place you custom config here.
	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
	// PeerEndpointLeaseReconciler updates the peer endpoint leases
	PeerEndpointLeaseReconciler peerreconcilers.PeerEndpointLeaseReconciler

	// For external resources and rest storage providers.
	ExternalRESTStorageProviders []storage.RESTStorageProvider

	// Number of masters running; all masters must be started with the
	// same value for this field. (Numbers > 1 currently untested.)
	MasterCount int

	//KubeVersionedInformers     kubeinformers.SharedInformerFactory
	InternalVersionedInformers kubeinformers.SharedInformerFactory
	ExternalVersionedInformers ExternalSharedInformerFactory
	ExternalPostStartHooks     map[string]genericapiserver.PostStartHookFunc
}

ExtraConfig defines extra configuration for the onex-apiserver.

type Instance

type Instance struct {
	GenericAPIServer *genericapiserver.GenericAPIServer
}

Instance contains state for a onex-apiserver instance.

func (*Instance) InstallAPIs

func (m *Instance) InstallAPIs(
	apiResourceConfigSource serverstorage.APIResourceConfigSource,
	restOptionsGetter generic.RESTOptionsGetter,
	restStorageProviders ...storage.RESTStorageProvider,
) error

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

func (*Instance) InstallLegacyAPI

func (m *Instance) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic.RESTOptionsGetter) error

InstallLegacyAPI will install the legacy APIs for the restStorageProviders if they are enabled.

Directories

Path Synopsis
admission
Package app does all of the work necessary to create a OneX APIServer by binding together the API, master and APIServer infrastructure.
Package app does all of the work necessary to create a OneX APIServer by binding together the API, master and APIServer infrastructure.
options
Package options contains flags and options for initializing an apiserver
Package options contains flags and options for initializing an apiserver
controller

Jump to

Keyboard shortcuts

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