Documentation ¶
Overview ¶
Package master contains code for setting up and running a Kubernetes cluster master.
Index ¶
- Constants
- func NewEtcdHelper(client tools.EtcdGetSet, version string, prefix string) (helper tools.EtcdHelper, err error)
- func NewHandlerContainer(mux *http.ServeMux) *restful.Container
- type Config
- type Controller
- func (c *Controller) CreateMasterServiceIfNeeded(serviceName string, serviceIP net.IP, servicePort int) error
- func (c *Controller) CreateNamespaceIfNeeded(ns string) error
- func (c *Controller) RunKubernetesROService(ch chan struct{})
- func (c *Controller) RunKubernetesService(ch chan struct{})
- func (c *Controller) SetEndpoints(serviceName string, ip net.IP, port int) error
- func (c *Controller) Start()
- func (c *Controller) UpdateKubernetesROService() error
- func (c *Controller) UpdateKubernetesService() error
- type Master
Constants ¶
const (
DefaultEtcdPathPrefix = "/registry"
)
Variables ¶
This section is empty.
Functions ¶
func NewEtcdHelper ¶
func NewEtcdHelper(client tools.EtcdGetSet, version string, prefix string) (helper tools.EtcdHelper, err error)
NewEtcdHelper returns an EtcdHelper for the provided arguments or an error if the version is incorrect.
func NewHandlerContainer ¶ added in v0.5.2
Types ¶
type Config ¶
type Config struct { EtcdHelper tools.EtcdHelper EventTTL time.Duration MinionRegexp string KubeletClient client.KubeletClient // allow downstream consumers to disable the core controller loops EnableCoreControllers bool EnableLogsSupport bool EnableUISupport bool // allow downstream consumers to disable swagger EnableSwaggerSupport bool // allow v1beta1 to be conditionally disabled DisableV1Beta1 bool // allow v1beta2 to be conditionally disabled DisableV1Beta2 bool // allow v1beta3 to be conditionally disabled DisableV1Beta3 bool // allow v1 to be conditionally enabled EnableV1 bool // allow downstream consumers to disable the index route EnableIndex bool EnableProfiling bool APIPrefix string CorsAllowedOriginList util.StringList Authenticator authenticator.Request // TODO(roberthbailey): Remove once the server no longer supports http basic auth. SupportsBasicAuth bool Authorizer authorizer.Authorizer AdmissionControl admission.Interface MasterServiceNamespace string // Map requests to contexts. Exported so downstream consumers can provider their own mappers RequestContextMapper api.RequestContextMapper // If specified, all web services will be registered into this container RestfulContainer *restful.Container // Number of masters running; all masters must be started with the // same value for this field. (Numbers > 1 currently untested.) MasterCount int // The port on PublicAddress where a read-only server will be installed. // Defaults to 7080 if not set. ReadOnlyPort int // The port on PublicAddress where a read-write server will be installed. // Defaults to 6443 if not set. ReadWritePort int // ExternalHost is the host name to use for external (public internet) facing URLs (e.g. Swagger) ExternalHost string // If nil, the first result from net.InterfaceAddrs will be used. PublicAddress net.IP // Control the interval that pod, node IP, and node heath status caches // expire. CacheTimeout time.Duration // The name of the cluster. ClusterName string // The range of IPs to be assigned to services with type=ClusterIP or greater ServiceClusterIPRange *net.IPNet // The range of ports to be assigned to services with type=NodePort or greater ServiceNodePortRange util.PortRange }
Config is a structure used to configure a Master.
type Controller ¶ added in v0.18.2
type Controller struct { NamespaceRegistry namespace.Registry ServiceRegistry service.Registry // TODO: MasterCount is yucky MasterCount int ServiceClusterIPRegistry service.RangeRegistry ServiceClusterIPInterval time.Duration ServiceClusterIPRange *net.IPNet ServiceNodePortRegistry service.RangeRegistry ServiceNodePortInterval time.Duration ServiceNodePortRange util.PortRange EndpointRegistry endpoint.Registry EndpointInterval time.Duration PublicIP net.IP ServiceIP net.IP ServicePort int PublicServicePort int ReadOnlyServiceIP net.IP ReadOnlyServicePort int PublicReadOnlyServicePort int // contains filtered or unexported fields }
Controller is the controller manager for the core bootstrap Kubernetes controller loops, which manage creating the "kubernetes" and "kubernetes-ro" services, the "default" namespace, and provide the IP repair check on service IPs
func (*Controller) CreateMasterServiceIfNeeded ¶ added in v0.18.2
func (c *Controller) CreateMasterServiceIfNeeded(serviceName string, serviceIP net.IP, servicePort int) error
CreateMasterServiceIfNeeded will create the specified service if it doesn't already exist.
func (*Controller) CreateNamespaceIfNeeded ¶ added in v0.18.2
func (c *Controller) CreateNamespaceIfNeeded(ns string) error
CreateNamespaceIfNeeded will create the namespace that contains the master services if it doesn't already exist
func (*Controller) RunKubernetesROService ¶ added in v0.18.2
func (c *Controller) RunKubernetesROService(ch chan struct{})
RunKubernetesROService periodically updates the kubernetes RO service
func (*Controller) RunKubernetesService ¶ added in v0.18.2
func (c *Controller) RunKubernetesService(ch chan struct{})
RunKubernetesService periodically updates the kubernetes service
func (*Controller) SetEndpoints ¶ added in v0.18.2
SetEndpoints sets the endpoints for the given apiserver service (ro or rw). SetEndpoints expects that the endpoints objects it manages will all be managed only by SetEndpoints; therefore, to understand this, you need only understand the requirements and the body of this function.
Requirements:
- All apiservers MUST use the same ports for their {rw, ro} services.
- All apiservers MUST use SetEndpoints and only SetEndpoints to manage the endpoints for their {rw, ro} services.
- All apiservers MUST know and agree on the number of apiservers expected to be running (c.masterCount).
- SetEndpoints is called periodically from all apiservers.
func (*Controller) Start ¶ added in v0.18.2
func (c *Controller) Start()
Start begins the core controller loops that must exist for bootstrapping a cluster.
func (*Controller) UpdateKubernetesROService ¶ added in v0.18.2
func (c *Controller) UpdateKubernetesROService() error
UpdateKubernetesROService attempts to update the default Kube read-only service.
func (*Controller) UpdateKubernetesService ¶ added in v0.18.2
func (c *Controller) UpdateKubernetesService() error
UpdateKubernetesService attempts to update the default Kube service.
type Master ¶
type Master struct { // "Outputs" Handler http.Handler InsecureHandler http.Handler // contains filtered or unexported fields }
Master contains state for a Kubernetes cluster master/api server.
func New ¶
New returns a new instance of Master from the given config. Certain config fields will be set to a default value if unset, including:
ServiceClusterIPRange ServiceNodePortRange MasterCount ReadOnlyPort ReadWritePort PublicAddress
Certain config fields must be specified, including:
KubeletClient
Public fields:
Handler -- The returned master has a field TopHandler which is an http.Handler which handles all the endpoints provided by the master, including the API, the UI, and miscelaneous debugging endpoints. All these are subject to authorization and authentication. InsecureHandler -- an http.Handler which handles all the same endpoints as Handler, but no authorization and authentication is done.
Public methods:
HandleWithAuth -- Allows caller to add an http.Handler for an endpoint that uses the same authentication and authorization (if any is configured) as the master's built-in endpoints. If the caller wants to add additional endpoints not using the master's auth, then the caller should create a handler for those endpoints, which delegates the any unhandled paths to "Handler".
func (*Master) HandleFuncWithAuth ¶ added in v0.5.2
func (m *Master) HandleFuncWithAuth(pattern string, handler func(http.ResponseWriter, *http.Request))
HandleFuncWithAuth adds an http.Handler for pattern to an http.ServeMux Applies the same authentication and authorization (if any is configured) to the request is used for the master's built-in endpoints.
func (*Master) HandleWithAuth ¶ added in v0.5.2
HandleWithAuth adds an http.Handler for pattern to an http.ServeMux Applies the same authentication and authorization (if any is configured) to the request is used for the master's built-in endpoints.
func (*Master) InstallSwaggerAPI ¶ added in v0.8.0
func (m *Master) InstallSwaggerAPI()
InstallSwaggerAPI installs the /swaggerapi/ endpoint to allow schema discovery and traversal. It is optional to allow consumers of the Kubernetes master to register their own web services into the Kubernetes mux prior to initialization of swagger, so that other resource types show up in the documentation.
func (*Master) NewBootstrapController ¶ added in v0.18.2
func (m *Master) NewBootstrapController() *Controller
NewBootstrapController returns a controller for watching the core capabilities of the master.