dockerswarm

package
v0.0.0-...-3e4e20d Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package dockerswarm discovers gRPC targets by inspecting Docker services.

Index

Constants

View Source
const (
	// DefaultMinPollInterval is the default for the minimum interval at which the
	// complete service list will be polled.
	DefaultMinPollInterval = 1 * time.Second

	// DefaultServerPort is the default TCP port used to connect to discovered
	// gRPC servers.
	DefaultServerPort = "https"
)
View Source
const (
	// ServiceIDKey is the target meta-data key for the Docker service ID.
	ServiceIDKey key = "docker.service.id"

	// ServiceNameKey is the target meta-data key for the Docker service name.
	ServiceNameKey key = "docker.service.name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

Client is an interface for the subset of the Docker client used by the Discoverer.

type Discoverer

type Discoverer struct {
	// Registry is the target registry to populate with discovered targets.
	Registry *flashlight.TargetRegistry

	// Client is the Docker client used to consume events and query services.
	Client Client

	// Network is the name of an overlay network that the services must be on.
	Network string

	// Filters is a set of service filters, usually labels, that limits the
	// services that are considered for discovery.
	Filters filters.Args

	// ServerPort is the TCP used to connect to the discovered gRPC servers.
	// If it is empty, DefaultServerPort is used.
	ServerPort string

	// ServerPortLabel is the name a label that can be used to override the
	// server port on a per-service basis.
	ServerPortLabel string

	// MinPollInterval is the minimum interval at which the complete service
	// list will be polled.
	MinPollInterval time.Duration
	// contains filtered or unexported fields
}

Discoverer finds gRPC targets by querying the Docker API to find services that match a user-supplied filter.

func (*Discoverer) Run

func (d *Discoverer) Run(ctx context.Context) error

Run keep the registry in sync with the services in Docker until ctx is canceled or an error occurs.

Jump to

Keyboard shortcuts

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