kubernetes: github.com/weilaihui/kubernetes/pkg/master Index | Files | Directories

package master

import "github.com/weilaihui/kubernetes/pkg/master"

Package master contains code for setting up and running a Kubernetes cluster master.


Package Files

doc.go ip_cache.go master.go pod_cache.go publish.go rest_to_nodes.go

func NewEtcdHelper Uses

func NewEtcdHelper(client tools.EtcdGetSet, version string) (helper tools.EtcdHelper, err error)

NewEtcdHelper returns an EtcdHelper for the provided arguments or an error if the version is incorrect.

func NewHandlerContainer Uses

func NewHandlerContainer(mux *http.ServeMux) *restful.Container

func NewIPCache Uses

func NewIPCache(cp cloudprovider.Interface, clock util.Clock, ttl time.Duration) *ipCache

NewIPCache makes a new ip caching layer, which will get IP addresses from cp, and use clock for deciding when to re-get an IP address. Thread-safe.

TODO: when we switch to go1.4, this class would be a good candidate for something that could be produced from a template and a type via `go generate`.

func RESTStorageToNodes Uses

func RESTStorageToNodes(storage apiserver.RESTStorage) client.NodesInterface

RESTStorageToNodes will take a RESTStorage object and return a client interface which will work for any use expecting a client.Nodes() interface. The advantage of doing this in server code is that it doesn't require an actual trip through the network.

TODO: considering that the only difference between the various client types and RESTStorage type is the type of the arguments, maybe use "go generate" to write a specialized adaptor for every client type?

TODO: this also means that pod and node API endpoints have to be colocated in the same process

type Config Uses

type Config struct {
    Client                 *client.Client
    Cloud                  cloudprovider.Interface
    EtcdHelper             tools.EtcdHelper
    HealthCheckMinions     bool
    EventTTL               time.Duration
    MinionRegexp           string
    KubeletClient          client.KubeletClient
    PortalNet              *net.IPNet
    EnableLogsSupport      bool
    EnableUISupport        bool
    EnableSwaggerSupport   bool
    EnableV1Beta3          bool
    APIPrefix              string
    CorsAllowedOriginList  util.StringList
    Authenticator          authenticator.Request
    Authorizer             authorizer.Authorizer
    AdmissionControl       admission.Interface
    MasterServiceNamespace string

    // 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 443 if not set.
    ReadWritePort int

    // If empty, the first result from net.InterfaceAddrs will be used.
    PublicAddress string

Config is a structure used to configure a Master.

type IPGetter Uses

type IPGetter interface {
    GetInstanceIP(host string) (ip string)

type Master Uses

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 Uses

func New(c *Config) *Master

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


Certain config fields must be specified, including:


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 Uses

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 Uses

func (m *Master) HandleWithAuth(pattern string, handler http.Handler)

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 Uses

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.

type PodCache Uses

type PodCache struct {
    // contains filtered or unexported fields

PodCache contains both a cache of container information, as well as the mechanism for keeping that cache up to date.

func NewPodCache Uses

func NewPodCache(ipCache IPGetter, info client.PodInfoGetter, nodes client.NodeInterface, pods pod.Registry) *PodCache

NewPodCache returns a new PodCache which watches container information registered in the given PodRegistry. TODO(lavalamp): pods should be a client.PodInterface.

func (*PodCache) ClearPodStatus Uses

func (p *PodCache) ClearPodStatus(namespace, name string)

func (*PodCache) GetPodStatus Uses

func (p *PodCache) GetPodStatus(namespace, name string) (*api.PodStatus, error)

GetPodStatus gets the stored pod status.

func (*PodCache) UpdateAllContainers Uses

func (p *PodCache) UpdateAllContainers()

UpdateAllContainers updates information about all containers. Callers should let one call to UpdateAllContainers finish before calling again, or risk having new info getting clobbered by delayed old info.


portsPackage ports defines ports used by various pieces of the kubernetes infrastructure.

Package master imports 45 packages (graph). Updated 2017-07-09. Refresh now. Tools for package owners.