mesosutils

package
v0.11.36 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(seconds float64) time.Duration

Duration translates float second values used by Marathon to go Duration format

func FindLabel

func FindLabel(labels []mesos.Label, key string) *mesos.Label

FindLabel returns a label matching given key

func GetLabelKeysByValue

func GetLabelKeysByValue(labels []mesos.Label, value string) []string

GetLabelKeysByValue searches provided labels for a given value and returns a list of matching keys

Types

type HTTPCheck added in v0.9.0

type HTTPCheck struct {
	Path string
}

HTTPCheck contains details about HTTP healthcheck

type HealthCheck added in v0.9.0

type HealthCheck struct {
	// Type specify healthcheck type
	Type HealthCheckType
	// Interval specify how often healthcheck should be performed
	Interval time.Duration
	// Timeout specify duration after healtcheck should be aborted and marked as unhealthy
	Timeout time.Duration
	// HTTP contains details about heatlhcheck when HTTP Type is set
	HTTP HTTPCheck
}

HealthCheck keeps details how to check task health

type HealthCheckType added in v0.9.0

type HealthCheckType int

HealthCheckType is type of healthcheck

const (
	// NONE represents empty healthcheck
	NONE HealthCheckType = iota
	// HTTP indicates HTTP field in HealthCheck is configured
	HTTP
	// TCP indicates healthcheck is TCP
	TCP
	// COMMAND indicates healthcheck is a command
	COMMAND
)

type TaskID added in v0.9.0

type TaskID string

TaskID is framework-generated ID to distinguish a task

type TaskInfo

type TaskInfo struct {
	TaskInfo mesos.TaskInfo
}

TaskInfo is a wrapper over Mesos TaskInfo providing convenient ways to access some of its values

func (TaskInfo) FindEnvValue

func (h TaskInfo) FindEnvValue(key string) string

FindEnvValue returns the value of an environment variable

func (TaskInfo) FindLabel

func (h TaskInfo) FindLabel(key string) *mesos.Label

FindLabel returns a label matching given key

func (TaskInfo) GetFirstPortWithLabel added in v0.11.26

func (h TaskInfo) GetFirstPortWithLabel(portLabel string) (*mesos.Port, error)

GetFirstPortWithLabel returns port with specified label

func (TaskInfo) GetHealthCheck added in v0.9.0

func (h TaskInfo) GetHealthCheck() (check HealthCheck)

GetHealthCheck returns

func (TaskInfo) GetLabelKeysByValue

func (h TaskInfo) GetLabelKeysByValue(value string) []string

GetLabelKeysByValue returns all keys of labels that contain a given value

func (TaskInfo) GetLabelValue

func (h TaskInfo) GetLabelValue(key string) string

GetLabelValue returns value for of a label

func (TaskInfo) GetPorts

func (h TaskInfo) GetPorts() []mesos.Port

GetPorts returns a list of task ports

func (TaskInfo) GetServiceID

func (h TaskInfo) GetServiceID() string

GetServiceID extracts service ID from labels in mesos TaskInfo. If it fails to do so, it returns executor ID.

func (TaskInfo) GetTaskID added in v0.9.0

func (h TaskInfo) GetTaskID() TaskID

GetTaskID returns id of the task

func (TaskInfo) GetWeight

func (h TaskInfo) GetWeight() (int, error)

GetWeight return a initial weight of the task. If weight is not set or has malformed format then returned weight is 0 and error is not nil.

Jump to

Keyboard shortcuts

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