listeners

package
v0.0.0-...-f3e8d88 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 0 Imported by: 0

README

package listeners

This package is providing the ServiceListener concept to the agent. A ServiceListener listens for events related to services the agent should monitor.

Service

Service reprensents an application we can run a check against. It should be matched with a check template by the ConfigResolver. Services can only be Docker containers for now.

ServiceListener (there is only a DockerListener for now)

ServiceListener monitors events related to Service lifecycles. It then formats and transmits this data to ConfigResolver.

DockerListener

DockerListener first gets current running containers and send these to ConfigResolver. Then it starts listening on the Docker event API for container activity and pass by Services mentioned in start/stop events to ConfigResolver through the corresponding channel.

TODO:

  • DockerListener calls Docker directly. We need a caching layer there.
  • support TLS
  • getHosts, getPorts and getTags need to use a caching layer for docker and use the k8s api (also with caching)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerService

type DockerService struct {
	ID            ID                // unique ID
	ADIdentifiers []string          // identifiers on which templates will be matched
	Hosts         map[string]string // network --> IP address
	Ports         []int
	Pid           int // Process identifier
}

DockerService implements and store results from the Service interface

type ID

type ID string

ID is the representation of the unique ID of a Service

type Service

type Service interface {
	GetID() ID
	GetADIdentifiers() ([]string, error)
	GetHosts() (map[string]string, error)
	GetPorts() ([]int, error)
	GetTags() ([]string, error)
	GetPid() (int, error)
}

Service represents an application we can run a check against. It should be matched with a check template by the ConfigResolver using the ADIdentifiers field.

type ServiceListener

type ServiceListener interface {
	Listen(newSvc, delSvc chan<- Service)
	Stop()
}

ServiceListener monitors running services and triggers check (un)scheduling

It holds a cache of running services, listens to new/killed services and updates its cache, and the ConfigResolver with these events.

Jump to

Keyboard shortcuts

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