Documentation ¶
Overview ¶
Package master contains code for setting up and running a Kubernetes cluster master.
Index ¶
- Constants
- func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig
- func ServiceIPRange(passedServiceClusterIPRange net.IPNet) (net.IPNet, net.IP, error)
- type CompletedConfig
- type Config
- type Controller
- func (c *Controller) CreateOrUpdateMasterServiceIfNeeded(serviceName string, serviceIP net.IP, servicePorts []corev1.ServicePort, ...) error
- func (c *Controller) PostStartHook(hookContext genericapiserver.PostStartHookContext) error
- func (c *Controller) PreShutdownHook() error
- func (c *Controller) RunKubernetesNamespaces(ch chan struct{})
- func (c *Controller) RunKubernetesService(ch chan struct{})
- func (c *Controller) Start()
- func (c *Controller) Stop()
- func (c *Controller) UpdateKubernetesService(reconcile bool) error
- type EndpointReconcilerConfig
- type ExtraConfig
- type Master
- type RESTStorageProvider
Constants ¶
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 )
Variables ¶
This section is empty.
Functions ¶
func DefaultAPIResourceConfigSource ¶
func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig
DefaultAPIResourceConfigSource returns default configuration for an APIResource.
func ServiceIPRange ¶
ServiceIPRange checks if the serviceClusterIPRange flag is nil, raising a warning if so and setting service ip range to the default value in kubeoptions.DefaultServiceIPCIDR for now until the default is removed per the deprecation timeline guidelines. Returns service ip range, api server service IP, and an error
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) (*Master, 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) NewBootstrapController ¶
func (c CompletedConfig) NewBootstrapController(legacyRESTStorage corerest.LegacyRESTStorage, serviceClient corev1client.ServicesGetter, nsClient corev1client.NamespacesGetter, eventClient corev1client.EventsGetter, healthClient rest.Interface) *Controller
NewBootstrapController returns a controller for watching the core capabilities of the master
type Config ¶
type Config struct { GenericConfig *genericapiserver.Config ExtraConfig ExtraConfig }
Config defines configuration for the master
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 Controller ¶
type Controller struct { ServiceClient corev1client.ServicesGetter NamespaceClient corev1client.NamespacesGetter EventClient corev1client.EventsGetter ServiceClusterIPRegistry rangeallocation.RangeRegistry ServiceClusterIPRange net.IPNet SecondaryServiceClusterIPRegistry rangeallocation.RangeRegistry SecondaryServiceClusterIPRange net.IPNet ServiceClusterIPInterval time.Duration ServiceNodePortRegistry rangeallocation.RangeRegistry ServiceNodePortInterval time.Duration ServiceNodePortRange utilnet.PortRange EndpointReconciler reconcilers.EndpointReconciler EndpointInterval time.Duration SystemNamespaces []string SystemNamespacesInterval time.Duration PublicIP net.IP // ServiceIP indicates where the kubernetes service will live. It may not be nil. ServiceIP net.IP ServicePort int ExtraServicePorts []corev1.ServicePort ExtraEndpointPorts []corev1.EndpointPort PublicServicePort int KubernetesServiceNodePort int // contains filtered or unexported fields }
Controller is the controller manager for the core bootstrap Kubernetes controller loops, which manage creating the "kubernetes" service, the "default", "kube-system" and "kube-public" namespaces, and provide the IP repair check on service IPs
func (*Controller) CreateOrUpdateMasterServiceIfNeeded ¶
func (c *Controller) CreateOrUpdateMasterServiceIfNeeded(serviceName string, serviceIP net.IP, servicePorts []corev1.ServicePort, serviceType corev1.ServiceType, reconcile bool) error
CreateOrUpdateMasterServiceIfNeeded will create the specified service if it doesn't already exist.
func (*Controller) PostStartHook ¶
func (c *Controller) PostStartHook(hookContext genericapiserver.PostStartHookContext) error
PostStartHook initiates the core controller loops that must exist for bootstrapping.
func (*Controller) PreShutdownHook ¶
func (c *Controller) PreShutdownHook() error
PreShutdownHook triggers the actions needed to shut down the API Server cleanly.
func (*Controller) RunKubernetesNamespaces ¶
func (c *Controller) RunKubernetesNamespaces(ch chan struct{})
RunKubernetesNamespaces periodically makes sure that all internal namespaces exist
func (*Controller) RunKubernetesService ¶
func (c *Controller) RunKubernetesService(ch chan struct{})
RunKubernetesService periodically updates the kubernetes service
func (*Controller) Start ¶
func (c *Controller) Start()
Start begins the core controller loops that must exist for bootstrapping a cluster.
func (*Controller) Stop ¶
func (c *Controller) Stop()
Stop cleans up this API Servers endpoint reconciliation leases so another master can take over more quickly.
func (*Controller) UpdateKubernetesService ¶
func (c *Controller) UpdateKubernetesService(reconcile bool) error
UpdateKubernetesService attempts to update the default Kube service.
type EndpointReconcilerConfig ¶
type EndpointReconcilerConfig struct { Reconciler reconcilers.EndpointReconciler Interval time.Duration }
EndpointReconcilerConfig holds the endpoint reconciler and endpoint reconciliation interval to be used by the master.
type ExtraConfig ¶
type ExtraConfig struct { ClusterAuthenticationInfo clusterauthenticationtrust.ClusterAuthenticationInfo APIResourceConfigSource serverstorage.APIResourceConfigSource StorageFactory serverstorage.StorageFactory EndpointReconcilerConfig EndpointReconcilerConfig EventTTL time.Duration KubeletClientConfig kubeletclient.KubeletClientConfig // Used to start and monitor tunneling Tunneler tunneler.Tunneler EnableLogsSupport bool ProxyTransport http.RoundTripper // Values to build the IP addresses used by discovery // The range of IPs to be assigned to services with type=ClusterIP or greater ServiceIPRange net.IPNet // The IP address for the GenericAPIServer service (must be inside ServiceIPRange) APIServerServiceIP net.IP // dual stack services, the range represents an alternative IP range for service IP // must be of different family than primary (ServiceIPRange) SecondaryServiceIPRange net.IPNet // the secondary IP address the GenericAPIServer service (must be inside SecondaryServiceIPRange) SecondaryAPIServerServiceIP net.IP // Port for the apiserver service. APIServerServicePort int // The range of ports to be assigned to services with type=NodePort or greater ServiceNodePortRange utilnet.PortRange // Additional ports to be exposed on the GenericAPIServer service // extraServicePorts is injectable in the event that more ports // (other than the default 443/tcp) are exposed on the GenericAPIServer // and those ports need to be load balanced by the GenericAPIServer // service because this pkg is linked by out-of-tree projects // like openshift which want to use the GenericAPIServer but also do // more stuff. ExtraServicePorts []apiv1.ServicePort // Additional ports to be exposed on the GenericAPIServer endpoints // Port names should align with ports defined in ExtraServicePorts ExtraEndpointPorts []apiv1.EndpointPort // If non-zero, the "kubernetes" services uses this port as NodePort. KubernetesServiceNodePort int // Number of masters running; all masters must be started with the // same value for this field. (Numbers > 1 currently untested.) MasterCount int // MasterEndpointReconcileTTL sets the time to live in seconds of an // endpoint record recorded by each master. The endpoints are checked at an // interval that is 2/3 of this value and this value defaults to 15s if // unset. In very large clusters, this value may be increased to reduce the // possibility that the master endpoint record expires (due to other load // on the etcd server) and causes masters to drop in and out of the // kubernetes service record. It is not recommended to set this value below // 15s. MasterEndpointReconcileTTL time.Duration // Selects which reconciler to use EndpointReconcilerType reconcilers.Type ServiceAccountIssuer serviceaccount.TokenGenerator ServiceAccountMaxExpiration time.Duration // ServiceAccountIssuerDiscovery ServiceAccountIssuerURL string ServiceAccountJWKSURI string ServiceAccountPublicKeys []interface{} VersionedInformers informers.SharedInformerFactory }
ExtraConfig defines extra configuration for the master
type Master ¶
type Master struct { GenericAPIServer *genericapiserver.GenericAPIServer ClusterAuthenticationInfo clusterauthenticationtrust.ClusterAuthenticationInfo }
Master contains state for a Kubernetes cluster master/api server.
func (*Master) InstallAPIs ¶
func (m *Master) InstallAPIs(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter, restStorageProviders ...RESTStorageProvider) error
InstallAPIs will install the APIs for the restStorageProviders if they are enabled.
func (*Master) InstallLegacyAPI ¶
func (m *Master) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic.RESTOptionsGetter, legacyRESTStorageProvider corerest.LegacyRESTStorageProvider) error
InstallLegacyAPI will install the legacy APIs for the restStorageProviders if they are enabled.
type RESTStorageProvider ¶
type RESTStorageProvider interface { GroupName() string NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool, error) }
RESTStorageProvider is a factory type for REST storage.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
controller
|
|
Package ports defines ports used by various pieces of the kubernetes infrastructure.
|
Package ports defines ports used by various pieces of the kubernetes infrastructure. |
Package reconcilers provides objects for managing the list of active masters.
|
Package reconcilers provides objects for managing the list of active masters. |