marathon

package
v2.2.0-rc.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultSDConfig is the default Marathon SD configuration.
	DefaultSDConfig = SDConfig{
		Timeout:         model.Duration(30 * time.Second),
		RefreshInterval: model.Duration(30 * time.Second),
	}
)

Functions

func AppsToTargetGroups added in v1.4.0

func AppsToTargetGroups(apps *AppList) map[string]*targetgroup.Group

AppsToTargetGroups takes an array of Marathon apps and converts them into target groups.

func RandomAppsURL added in v1.4.0

func RandomAppsURL(servers []string) string

RandomAppsURL randomly selects a server from an array and creates an URL pointing to the app list.

Types

type App added in v1.4.0

type App struct {
	ID              string            `json:"id"`
	Tasks           []Task            `json:"tasks"`
	RunningTasks    int               `json:"tasksRunning"`
	Labels          map[string]string `json:"labels"`
	Container       Container         `json:"container"`
	PortDefinitions []PortDefinitions `json:"portDefinitions"`
}

App describes a service running on Marathon.

type AppList added in v1.4.0

type AppList struct {
	Apps []App `json:"apps"`
}

AppList is a list of Marathon apps.

type AppListClient added in v1.4.0

type AppListClient func(client *http.Client, url, token string) (*AppList, error)

AppListClient defines a function that can be used to get an application list from marathon.

type Container added in v1.4.0

type Container struct {
	Docker       DockerContainer `json:"docker"`
	PortMappings []PortMappings  `json:"portMappings"`
}

Container describes the runtime an app in running in.

type Discovery

type Discovery struct {
	// contains filtered or unexported fields
}

Discovery provides service discovery based on a Marathon instance.

func NewDiscovery

func NewDiscovery(conf SDConfig, logger log.Logger) (*Discovery, error)

NewDiscovery returns a new Marathon Discovery.

func (*Discovery) Run added in v1.4.0

func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group)

Run implements the Discoverer interface.

type DockerContainer added in v1.4.0

type DockerContainer struct {
	Image        string         `json:"image"`
	PortMappings []PortMappings `json:"portMappings"`
}

DockerContainer describes a container which uses the docker runtime.

type PortDefinitions added in v1.6.0

type PortDefinitions struct {
	Labels map[string]string `json:"labels"`
}

PortDefinitions describes which load balancer port you should access to access the service.

type PortMappings added in v1.6.0

type PortMappings struct {
	Labels map[string]string `json:"labels"`
}

PortMappings describes in which port the process are binding inside the docker container.

type SDConfig

type SDConfig struct {
	Servers         []string              `yaml:"servers,omitempty"`
	Timeout         model.Duration        `yaml:"timeout,omitempty"`
	RefreshInterval model.Duration        `yaml:"refresh_interval,omitempty"`
	TLSConfig       config_util.TLSConfig `yaml:"tls_config,omitempty"`
	BearerToken     config_util.Secret    `yaml:"bearer_token,omitempty"`
	BearerTokenFile string                `yaml:"bearer_token_file,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline"`
}

SDConfig is the configuration for services running on Marathon.

func (*SDConfig) UnmarshalYAML

func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Task added in v1.4.0

type Task struct {
	ID    string   `json:"id"`
	Host  string   `json:"host"`
	Ports []uint32 `json:"ports"`
}

Task describes one instance of a service running on Marathon.

Jump to

Keyboard shortcuts

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