Documentation ¶
Overview ¶
Package kubelet is ...
Index ¶
- type DockerInterface
- type Kubelet
- func (sl *Kubelet) ContainerExists(manifest *api.ContainerManifest, container *api.Container) (exists bool, foundName string, err error)
- func (sl *Kubelet) ExtractYAMLData(buf []byte, output interface{}) error
- func (sl *Kubelet) GetContainerByName(name string) (*docker.Container, error)
- func (sl *Kubelet) GetContainerID(name string) (string, error)
- func (sl *Kubelet) GetContainerInfo(name string) (string, error)
- func (sl *Kubelet) KillContainer(name string) error
- func (sl *Kubelet) ListContainers() ([]string, error)
- func (sl *Kubelet) LogEvent(event *api.Event) error
- func (sl *Kubelet) ResponseToManifests(response *etcd.Response) ([]api.ContainerManifest, error)
- func (sl *Kubelet) RunContainer(manifest *api.ContainerManifest, container *api.Container) (name string, err error)
- func (sl *Kubelet) RunKubelet(file, manifest_url, etcd_servers, address string, port uint)
- func (sl *Kubelet) RunSyncLoop(etcdChannel <-chan []api.ContainerManifest, handler SyncHandler)
- func (sl *Kubelet) SyncAndSetupEtcdWatch(changeChannel chan<- []api.ContainerManifest)
- func (sl *Kubelet) SyncManifests(config []api.ContainerManifest) error
- func (sl *Kubelet) TimeoutWatch(done chan bool)
- func (sl *Kubelet) WatchEtcd(watchChannel <-chan *etcd.Response, ...)
- type State
- type SyncHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerInterface ¶
type DockerInterface interface { ListContainers(options docker.ListContainersOptions) ([]docker.APIContainers, error) InspectContainer(id string) (*docker.Container, error) CreateContainer(docker.CreateContainerOptions) (*docker.Container, error) StartContainer(id string, hostConfig *docker.HostConfig) error StopContainer(id string, timeout uint) error }
Interface for testability
type Kubelet ¶
type Kubelet struct { Client registry.EtcdClient DockerClient DockerInterface FileCheckFrequency time.Duration SyncFrequency time.Duration HTTPCheckFrequency time.Duration Hostname string // contains filtered or unexported fields }
The main kubelet implementation
func (*Kubelet) ContainerExists ¶
func (sl *Kubelet) ContainerExists(manifest *api.ContainerManifest, container *api.Container) (exists bool, foundName string, err error)
Does this container exist on this host? Returns true if so, and the name under which the container is running. Returns an error if one occurs.
func (*Kubelet) ExtractYAMLData ¶
Extract data from YAML file into a list of containers.
func (*Kubelet) GetContainerByName ¶
Get a container by name. returns the container data from Docker, or an error if one exists.
func (*Kubelet) KillContainer ¶
func (*Kubelet) ListContainers ¶
func (*Kubelet) ResponseToManifests ¶
Take an etcd Response object, and turn it into a structured list of containers Return a list of containers, or an error if one occurs.
func (*Kubelet) RunContainer ¶
func (*Kubelet) RunKubelet ¶
Starts background goroutines. If file, manifest_url, or address are empty, they are not watched. Never returns.
func (*Kubelet) RunSyncLoop ¶
func (sl *Kubelet) RunSyncLoop(etcdChannel <-chan []api.ContainerManifest, handler SyncHandler)
runSyncLoop is the main loop for processing changes. It watches for changes from four channels (file, etcd, server, and http) and creates a union of the two. For any new change seen, will run a sync against desired state and running state. If no changes are seen to the configuration, will synchronize the last known desired state every sync_frequency seconds. Never returns.
func (*Kubelet) SyncAndSetupEtcdWatch ¶
func (sl *Kubelet) SyncAndSetupEtcdWatch(changeChannel chan<- []api.ContainerManifest)
Sync with etcd, and set up an etcd watch for new configurations The channel to send new configurations across This function loops forever and is intended to be run in a go routine.
func (*Kubelet) SyncManifests ¶
func (sl *Kubelet) SyncManifests(config []api.ContainerManifest) error
Sync the configured list of containers (desired state) with the host current state
func (*Kubelet) TimeoutWatch ¶
Timeout the watch after 30 seconds
type SyncHandler ¶
type SyncHandler interface {
SyncManifests([]api.ContainerManifest) error
}
Interface implemented by Kubelet, for testability