package apiserver
import "k8s.io/kubernetes/pkg/controlplane/apiserver"
Index ¶
- Constants
- Variables
- func BuildAuthorizer(ctx context.Context, s options.CompletedOptions, egressSelector *egressselector.EgressSelector, apiserverID string, versionedInformers clientgoinformers.SharedInformerFactory) (authorizer.Authorizer, authorizer.RuleResolver, bool, error)
- 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, )
- func BuildPeerProxy( leaseInformer coordinationv1informers.LeaseInformer, loopbackClientConfig *rest.Config, proxyClientCertFile string, proxyClientKeyFile string, peerCAFile string, peerAdvertiseAddress reconcilers.PeerAdvertiseAddress, apiServerID string, reconciler reconcilers.PeerEndpointLeaseReconciler, serializer runtime.NegotiatedSerializer) (utilpeerproxy.Interface, error)
- 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( 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(aggregatorConfig aggregatorapiserver.CompletedConfig, delegateAPIServer genericapiserver.DelegationTarget, crds apiextensionsinformers.CustomResourceDefinitionInformer, crdAPIEnabled bool, apiVersionPriorities map[schema.GroupVersion]APIServicePriority) (*aggregatorapiserver.APIAggregator, error)
- func CreatePeerEndpointLeaseReconciler(c genericapiserver.Config, storageFactory serverstorage.StorageFactory) (reconcilers.PeerEndpointLeaseReconciler, error)
- func CreateProxyTransport() *http.Transport
- func DefaultGenericAPIServicePriorities() map[schema.GroupVersion]APIServicePriority
- type APIServicePriority
- type CompletedConfig
- func (c *CompletedConfig) GenericStorageProviders(discovery discovery.DiscoveryInterface) ([]RESTStorageProvider, error)
- func (c CompletedConfig) New(name string, delegationTarget genericapiserver.DelegationTarget) (*Server, error)
- func (c *CompletedConfig) NewCoreGenericConfig() *corerest.GenericConfig
- type Config
- func CreateConfig( opts options.CompletedOptions, genericConfig *genericapiserver.Config, versionedInformers clientgoinformers.SharedInformerFactory, storageFactory *serverstorage.DefaultStorageFactory, serviceResolver aggregatorapiserver.ServiceResolver, additionalInitializers []admission.PluginInitializer, ) ( *Config, []admission.PluginInitializer, error, )
- func (c *Config) Complete() CompletedConfig
- type Extra
- type RESTStorageProvider
- type Server
Constants ¶
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 )
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" // KubeAPIServer defines variable used internally when referring to kube-apiserver component KubeAPIServer = "kube-apiserver" )
Variables ¶
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 ¶
func BuildAuthorizer(ctx context.Context, s options.CompletedOptions, egressSelector *egressselector.EgressSelector, apiserverID string, versionedInformers clientgoinformers.SharedInformerFactory) (authorizer.Authorizer, authorizer.RuleResolver, bool, error)
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( leaseInformer coordinationv1informers.LeaseInformer, loopbackClientConfig *rest.Config, 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 ¶
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 ¶
func CreateAggregatorServer(aggregatorConfig aggregatorapiserver.CompletedConfig, delegateAPIServer genericapiserver.DelegationTarget, crds apiextensionsinformers.CustomResourceDefinitionInformer, crdAPIEnabled bool, apiVersionPriorities map[schema.GroupVersion]APIServicePriority) (*aggregatorapiserver.APIAggregator, error)
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 ¶
CreateProxyTransport creates the dialer infrastructure to connect to the nodes.
func DefaultGenericAPIServicePriorities ¶
func DefaultGenericAPIServicePriorities() map[schema.GroupVersion]APIServicePriority
DefaultGenericAPIServicePriorities returns the APIService priorities for generic APIs
Types ¶
type APIServicePriority ¶
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 ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
CompletedConfig embeds a private pointer that cannot be instantiated outside of this package
func (*CompletedConfig) GenericStorageProviders ¶
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 ¶
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 ¶
func (c *CompletedConfig) NewCoreGenericConfig() *corerest.GenericConfig
NewCoreGenericConfig returns a new core rest generic config.
type Config ¶
type Config struct { Generic *genericapiserver.Config Extra }
Config defines configuration for the master
func CreateConfig ¶
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 ¶
func (c *Config) Complete() CompletedConfig
type Extra ¶
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 ServiceAccountExtendedMaxExpiration time.Duration ExtendExpiration bool // ServiceAccountIssuerDiscovery ServiceAccountIssuerURL string ServiceAccountJWKSURI string ServiceAccountPublicKeysGetter serviceaccount.PublicKeysGetter SystemNamespaces []string VersionedInformers clientgoinformers.SharedInformerFactory }
type RESTStorageProvider ¶
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 ¶
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 ¶
func (s *Server) InstallAPIs(restStorageProviders ...RESTStorageProvider) error
InstallAPIs will install the APIs for the restStorageProviders if they are enabled.
Source Files ¶
aggregator.go apiextensions.go apis.go completion.go config.go peer.go server.go
Directories ¶
Path | Synopsis |
---|---|
pkg/controlplane/apiserver/admission | |
pkg/controlplane/apiserver/options | Package options contains flags and options for initializing an apiserver |
pkg/controlplane/apiserver/samples | Package samples contains two kube-like generic control plane apiserver, one with CRDs (generic) and one without (minimum). |
pkg/controlplane/apiserver/samples/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. |
pkg/controlplane/apiserver/samples/generic/server | |
pkg/controlplane/apiserver/samples/generic/server/testing |
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 94 packages
- Last checked
- 3 hours ago –
Tools for package owners.