Documentation ¶
Overview ¶
Package kubelet is ...
Index ¶
- type DockerContainerData
- type DockerInterface
- type Kubelet
- func (kl *Kubelet) ContainerExists(manifest *api.ContainerManifest, container *api.Container) (exists bool, foundName string, err error)
- func (kl *Kubelet) ExtractYAMLData(buf []byte, output interface{}) error
- func (kl *Kubelet) GetContainerByName(name string) (*docker.Container, error)
- func (kl *Kubelet) GetContainerID(name string) (string, error)
- func (kl *Kubelet) GetContainerInfo(name string) (string, error)
- func (kl *Kubelet) KillContainer(name string) error
- func (kl *Kubelet) ListContainers() ([]string, error)
- func (kl *Kubelet) LogEvent(event *api.Event) error
- func (kl *Kubelet) ResponseToManifests(response *etcd.Response) ([]api.ContainerManifest, error)
- func (kl *Kubelet) RunContainer(manifest *api.ContainerManifest, container *api.Container) (name string, err error)
- func (kl *Kubelet) RunKubelet(file, manifest_url, etcd_servers, address string, port uint)
- func (kl *Kubelet) RunSyncLoop(etcdChannel <-chan []api.ContainerManifest, ...)
- func (kl *Kubelet) SyncAndSetupEtcdWatch(changeChannel chan<- []api.ContainerManifest)
- func (kl *Kubelet) SyncHTTP(client *http.Client, url string, config *api.ContainerManifest) ([]byte, error)
- func (kl *Kubelet) SyncManifests(config []api.ContainerManifest) error
- func (kl *Kubelet) TimeoutWatch(done chan bool)
- func (kl *Kubelet) WatchEtcd(watchChannel <-chan *etcd.Response, ...)
- func (kl *Kubelet) WatchFile(file string, changeChannel chan<- api.ContainerManifest)
- func (kl *Kubelet) WatchHTTP(url string, changeChannel chan<- api.ContainerManifest)
- type KubeletServer
- type State
- type SyncHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerContainerData ¶
type DockerContainerData struct {
// contains filtered or unexported fields
}
The structured representation of the JSON object returned by Docker inspect
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 { Hostname string Client registry.EtcdClient DockerClient DockerInterface FileCheckFrequency time.Duration SyncFrequency time.Duration HTTPCheckFrequency time.Duration // contains filtered or unexported fields }
The main kubelet implementation
func (*Kubelet) ContainerExists ¶
func (kl *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 (kl *Kubelet) RunSyncLoop(etcdChannel <-chan []api.ContainerManifest, fileChannel, serverChannel, httpChannel <-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 (kl *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) SyncHTTP ¶
func (kl *Kubelet) SyncHTTP(client *http.Client, url string, config *api.ContainerManifest) ([]byte, error)
SyncHTTP reads from url a yaml manifest and populates config. Returns the raw bytes, if something was read. Returns an error if something goes wrong. 'client' is used to execute the request, to allow caching of clients.
func (*Kubelet) SyncManifests ¶
func (kl *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
func (*Kubelet) WatchEtcd ¶
func (kl *Kubelet) WatchEtcd(watchChannel <-chan *etcd.Response, changeChannel chan<- []api.ContainerManifest)
Watch etcd for changes, receives config objects from the etcd client watch. This function loops forever and is intended to be run as a goroutine.
type KubeletServer ¶
type KubeletServer struct { Kubelet kubeletInterface UpdateChannel chan api.ContainerManifest }
func (*KubeletServer) ServeHTTP ¶
func (s *KubeletServer) ServeHTTP(w http.ResponseWriter, req *http.Request)
type SyncHandler ¶
type SyncHandler interface {
SyncManifests([]api.ContainerManifest) error
}
Interface implemented by Kubelet, for testability