add_docker_metadata

package
v0.0.0-...-99b9a3e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWatcherWithClient

func NewWatcherWithClient(client Client, cleanupTimeout time.Duration) (*watcher, error)

Types

type Client

type Client interface {
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
	Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
}

Client for docker interface

type Config

type Config struct {
	Host        string     `config:"host"`
	TLS         *TLSConfig `config:"ssl"`
	Fields      []string   `config:"match_fields"`
	MatchSource bool       `config:"match_source"`
	SourceIndex int        `config:"match_source_index"`

	// Annotations are kept after container is killled, until they haven't been accessed
	// for a full `cleanup_timeout`:
	CleanupTimeout time.Duration `config:"cleanup_timeout"`
}

Config for docker processor

type Container

type Container struct {
	ID     string
	Name   string
	Image  string
	Labels map[string]string
}

Container info retrieved by the watcher

type TLSConfig

type TLSConfig struct {
	CA          string `config:"certificate_authority"`
	Certificate string `config:"certificate"`
	Key         string `config:"key"`
}

TLSConfig for docker socket connection

type Watcher

type Watcher interface {
	// Start watching docker API for new containers
	Start() error

	// Stop watching docker API for new containers
	Stop()

	// Container returns the running container with the given ID or nil if unknown
	Container(ID string) *Container

	// Containers returns the list of known containers
	Containers() map[string]*Container
}

Watcher reads docker events and keeps a list of known containers

func NewWatcher

func NewWatcher(host string, tls *TLSConfig) (Watcher, error)

NewWatcher returns a watcher running for the given settings

type WatcherConstructor

type WatcherConstructor func(host string, tls *TLSConfig) (Watcher, error)

Jump to

Keyboard shortcuts

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