marathon

package
v0.0.0-...-35f0b6d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppsToTargetGroups

func AppsToTargetGroups(apps *AppList) map[string]*config.TargetGroup

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

func RandomAppsURL

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

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

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

AppList is a list of Marathon apps.

type AppListClient

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

type Container struct {
	Docker DockerContainer `json:"docker"`
}

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 *config.MarathonSDConfig, logger log.Logger) (*Discovery, error)

NewDiscovery returns a new Marathon Discovery.

func (*Discovery) Run

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

Run implements the TargetProvider interface.

type DockerContainer

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

DockerContainer describes a container which uses the docker runtime.

type PortDefinitions

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

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

type PortMappings

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

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

type Task

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