app

package
v1.1.0-alpha.0....-00e3442 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Overview

Package app makes it easy to create a kubelet server for various contexts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProbeNetworkPlugins

func ProbeNetworkPlugins(pluginDir string) []network.NetworkPlugin

ProbeNetworkPlugins collects all compiled-in plugins

func ProbeVolumePlugins

func ProbeVolumePlugins() []volume.VolumePlugin

ProbeVolumePlugins collects all volume plugins into an easy to use list.

func RunKubelet

func RunKubelet(kcfg *KubeletConfig, builder KubeletBuilder) error

RunKubelet is responsible for setting up and running a kubelet. It is used in three different applications:

1 Integration tests
2 Kubelet binary
3 Standalone 'kubernetes' binary

Eventually, #2 will be replaced with instances of #3

Types

type KubeletBootstrap

type KubeletBootstrap interface {
	BirthCry()
	StartGarbageCollection()
	ListenAndServe(net.IP, uint, *kubelet.TLSOptions, bool)
	ListenAndServeReadOnly(net.IP, uint)
	Run(<-chan kubelet.PodUpdate)
	RunOnce(<-chan kubelet.PodUpdate) ([]kubelet.RunPodResult, error)
}

bootstrapping interface for kubelet, targets the initialization protocol

type KubeletBuilder

type KubeletBuilder func(kc *KubeletConfig) (KubeletBootstrap, *config.PodConfig, error)

create and initialize a Kubelet instance

type KubeletConfig

type KubeletConfig struct {
	KubeClient                     *client.Client
	DockerClient                   dockertools.DockerInterface
	CadvisorInterface              cadvisor.Interface
	Address                        net.IP
	AllowPrivileged                bool
	HostNetworkSources             []string
	HostnameOverride               string
	RootDirectory                  string
	ConfigFile                     string
	ManifestURL                    string
	ManifestURLHeader              http.Header
	FileCheckFrequency             time.Duration
	HTTPCheckFrequency             time.Duration
	Hostname                       string
	NodeName                       string
	PodInfraContainerImage         string
	SyncFrequency                  time.Duration
	RegistryPullQPS                float64
	RegistryBurst                  int
	MinimumGCAge                   time.Duration
	MaxPerPodContainerCount        int
	MaxContainerCount              int
	RegisterNode                   bool
	StandaloneMode                 bool
	ClusterDomain                  string
	ClusterDNS                     net.IP
	EnableServer                   bool
	EnableDebuggingHandlers        bool
	Port                           uint
	ReadOnlyPort                   uint
	Runonce                        bool
	MasterServiceNamespace         string
	VolumePlugins                  []volume.VolumePlugin
	NetworkPlugins                 []network.NetworkPlugin
	NetworkPluginName              string
	StreamingConnectionIdleTimeout time.Duration
	Recorder                       record.EventRecorder
	TLSOptions                     *kubelet.TLSOptions
	ImageGCPolicy                  kubelet.ImageGCPolicy
	DiskSpacePolicy                kubelet.DiskSpacePolicy
	Cloud                          cloudprovider.Interface
	NodeStatusUpdateFrequency      time.Duration
	ResourceContainer              string
	OSInterface                    kubecontainer.OSInterface
	CgroupRoot                     string
	ContainerRuntime               string
	RktPath                        string
	Mounter                        mount.Interface
	DockerDaemonContainer          string
	SystemContainer                string
	ConfigureCBR0                  bool
	PodCIDR                        string
	MaxPods                        int
	DockerExecHandler              dockertools.ExecHandler
}

KubeletConfig is all of the parameters necessary for running a kubelet. TODO: This should probably be merged with KubeletServer. The extra object is a consequence of refactoring.

func SimpleKubelet

func SimpleKubelet(client *client.Client,
	dockerClient dockertools.DockerInterface,
	hostname, rootDir, manifestURL, address string,
	port uint,
	masterServiceNamespace string,
	volumePlugins []volume.VolumePlugin,
	tlsOptions *kubelet.TLSOptions,
	cadvisorInterface cadvisor.Interface,
	configFilePath string,
	cloud cloudprovider.Interface,
	osInterface kubecontainer.OSInterface) *KubeletConfig

SimpleRunKubelet is a simple way to start a Kubelet talking to dockerEndpoint, using an API Client. Under the hood it calls RunKubelet (below)

type KubeletServer

type KubeletServer struct {
	Config                         string
	SyncFrequency                  time.Duration
	FileCheckFrequency             time.Duration
	HTTPCheckFrequency             time.Duration
	ManifestURL                    string
	ManifestURLHeader              string
	EnableServer                   bool
	Address                        net.IP
	Port                           uint
	ReadOnlyPort                   uint
	HostnameOverride               string
	PodInfraContainerImage         string
	DockerEndpoint                 string
	RootDirectory                  string
	AllowPrivileged                bool
	HostNetworkSources             string
	RegistryPullQPS                float64
	RegistryBurst                  int
	RunOnce                        bool
	EnableDebuggingHandlers        bool
	MinimumGCAge                   time.Duration
	MaxPerPodContainerCount        int
	MaxContainerCount              int
	AuthPath                       util.StringFlag // Deprecated -- use KubeConfig instead
	KubeConfig                     util.StringFlag
	CadvisorPort                   uint
	HealthzPort                    int
	HealthzBindAddress             net.IP
	OOMScoreAdj                    int
	APIServerList                  []string
	RegisterNode                   bool
	StandaloneMode                 bool
	ClusterDomain                  string
	MasterServiceNamespace         string
	ClusterDNS                     net.IP
	StreamingConnectionIdleTimeout time.Duration
	ImageGCHighThresholdPercent    int
	ImageGCLowThresholdPercent     int
	LowDiskSpaceThresholdMB        int
	NetworkPluginName              string
	NetworkPluginDir               string
	CloudProvider                  string
	CloudConfigFile                string
	TLSCertFile                    string
	TLSPrivateKeyFile              string
	CertDirectory                  string
	NodeStatusUpdateFrequency      time.Duration
	ResourceContainer              string
	CgroupRoot                     string
	ContainerRuntime               string
	RktPath                        string
	DockerDaemonContainer          string
	SystemContainer                string
	ConfigureCBR0                  bool
	PodCIDR                        string
	MaxPods                        int
	DockerExecHandlerName          string

	// Crash immediately, rather than eating panics.
	ReallyCrashForTesting bool
	// Insert a probability of random errors during calls to the master.
	ChaosChance float64
	// Is the kubelet containerized?
	Containerized bool
}

KubeletServer encapsulates all of the parameters necessary for starting up a kubelet. These can either be set via command line or directly.

func NewKubeletServer

func NewKubeletServer() *KubeletServer

NewKubeletServer will create a new KubeletServer with default values.

func (*KubeletServer) AddFlags

func (s *KubeletServer) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for a specific KubeletServer to the specified FlagSet

func (*KubeletServer) CreateAPIServerClientConfig

func (s *KubeletServer) CreateAPIServerClientConfig() (*client.Config, error)

CreateAPIServerClientConfig generates a client.Config from command line flags, including api-server-list, via createClientConfig and then injects chaos into the configuration via addChaosToClientConfig. This func is exported to support integration with third party kubelet extensions (e.g. kubernetes-mesos).

func (*KubeletServer) InitializeTLS

func (s *KubeletServer) InitializeTLS() (*kubelet.TLSOptions, error)

InitializeTLS checks for a configured TLSCertFile and TLSPrivateKeyFile: if unspecified a new self-signed certificate and key file are generated. Returns a configured kubelet.TLSOptions object.

func (*KubeletServer) KubeletConfig

func (s *KubeletServer) KubeletConfig() (*KubeletConfig, error)

KubeletConfig returns a KubeletConfig suitable for being run, or an error if the server setup is not valid. It will not start any background processes.

func (*KubeletServer) Run

func (s *KubeletServer) Run(kcfg *KubeletConfig) error

Run runs the specified KubeletServer for the given KubeletConfig. This should never exit. The kcfg argument may be nil - if so, it is initialized from the settings on KubeletServer. Otherwise, the caller is assumed to have set up the KubeletConfig object and all defaults will be ignored.

Jump to

Keyboard shortcuts

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