marathon

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: AGPL-3.0 Imports: 40 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// The key of the oversold ratio in the configuration
	CPU_SUBSCRIBE_RATIO = "CPU_SUBSCRIBE_RATIO"

	// 100000  /sys/fs/cgroup/cpu/cpu.cfs_period_us default value
	CPU_CFS_PERIOD_US int = 100000
	// Minimum application cpu value
	MIN_CPU_SIZE = 0.1

	HCMethodCommand = "COMMAND"
	HCMethodTCP     = "TCP"
)
View Source
const (
	PERIOD     = 60
	TIMES      = 3
	PROTECTION = 600
)

Variables

This section is empty.

Functions

func AND

func AND(ss ...string) *andrule

AND Semantically equal to'&' (and)

Types

type App

type App struct {
	Id   string   `json:"id"`
	Cmd  string   `json:"cmd,omitempty"`
	Args []string `json:"args,omitempty"`
	User string   `json:"user,omitempty"`

	Instances int     `json:"instances"`
	Cpus      float64 `json:"cpus"`
	Mem       float64 `json:"mem"`
	Disk      float64 `json:"disk"`

	Container AppContainer `json:"container"`

	Dependencies []string `json:"dependencies"`

	Env map[string]string `json:"env,omitempty"`

	Executor              string       `json:"executor,omitempty"`
	AcceptedResourceRoles []string     `json:"acceptedResourceRoles,omitempty"`
	Constraints           []Constraint `json:"constraints,omitempty"`

	Uris    []string             `json:"uris,omitempty"`
	Fetch   []AppFetch           `json:"fetch,omitempty"`
	Secrets map[string]AppSecret `json:"secrets,omitempty"`

	// Since: 1.5
	Networks []AppNetwork `json:"networks,omitempty"`
	// Deprecated: >= 1.5
	IpAddress      *AppIpAddress       `json:"ipAddress,omitempty"`
	Ports          []int               `json:"ports"`
	RequirePorts   bool                `json:"requirePorts,omitempty"`
	PortDefinition []AppPortDefinition `json:"portDefinitions,omitempty"`

	UpgradeStrategy            *AppUpgradeStrategy `json:"upgradeStrategy,omitempty"`
	BackoffSeconds             int                 `json:"backoffSeconds"`
	BackoffFactor              float32             `json:"backoffFactor"`
	MaxLaunchDelaySeconds      int                 `json:"maxLaunchDelaySeconds"`
	TaskKillGracePeriodSeconds int                 `json:"taskKillGracePeriodSeconds,omitempty"`

	HealthChecks    []AppHealthCheck    `json:"healthChecks"`
	ReadinessChecks []AppReadinessCheck `json:"readinessChecks,omitempty"`
	Labels          map[string]string   `json:"labels"`

	Tty bool `json:"tty,omitempty"`

	AppTasks
	AppCounts
	AppDeployments
}

type AppContainer

type AppContainer struct {
	Type   string             `json:"type,omitempty"`
	Docker AppContainerDocker `json:"docker,omitempty"`
	// Since: 1.5
	PortMappings []AppContainerPortMapping `json:"portMappings,omitempty"`
	Volumes      []AppContainerVolume      `json:"volumes,omitempty"`
}

type AppContainerDocker

type AppContainerDocker struct {
	ForcePullImage bool                          `json:"forcePullImage,omitempty"`
	Image          string                        `json:"image"`
	Parameters     []AppContainerDockerParameter `json:"parameters,omitempty"`
	Privileged     bool                          `json:"privileged,omitempty"`
	// Deprecated: >=1.5
	Network string `json:"network,omitempty"`
	// Deprecated: >= 1.5
	PortMappings []AppContainerPortMapping `json:"portMappings"`
}

type AppContainerDockerParameter

type AppContainerDockerParameter struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type AppContainerPortMapping

type AppContainerPortMapping struct {
	Name          string            `json:"name,omitempty"`
	Labels        map[string]string `json:"labels,omitempty"`
	Protocol      string            `json:"protocol,omitempty"`
	ContainerPort int               `json:"containerPort"`
	HostPort      int               `json:"hostPort,omitempty"`
	ServicePort   int               `json:"servicePort,omitempty"`
}

type AppContainerVolume

type AppContainerVolume struct {
	Mode          string `json:"mode,omitempty"`
	ContainerPath string `json:"containerPath,omitempty"`
	HostPath      string `json:"hostPath,omitempty"`
	// TODO: refactor it
	Persistent *apistructs.PersistentVolume `json:"persistent,omitempty"`
}

type AppCounts

type AppCounts struct {
	TasksStaged    int `json:"tasksStaged"`
	TasksRunning   int `json:"tasksRunning"`
	TasksHealthy   int `json:"tasksHealthy"`
	TasksUnhealthy int `json:"tasksUnhealthy"`
}

type AppDeployment

type AppDeployment struct {
	Id string `json:"id"`
}

type AppDeployments

type AppDeployments struct {
	Deployments []AppDeployment `json:"deployments"`
}

type AppFetch

type AppFetch struct {
	Uri        string `json:"uri"`
	Executable bool   `json:"executable,omitempty"`
	Extract    bool   `json:"extract,omitempty"`
	Cache      bool   `json:"cache,omitempty"`
	DestPath   string `json:"destPath,omitempty"`
}

type AppGet

type AppGet struct {
	App ShortApp `json:"app"`
}

type AppHealthCheck

type AppHealthCheck struct {
	GracePeriodSeconds     int  `json:"gracePeriodSeconds"`
	IgnoreHttp1xx          bool `json:"ignoreHttp1xx,omitempty"`
	IntervalSeconds        int  `json:"intervalSeconds,omitempty"`
	MaxConsecutiveFailures int  `json:"maxConsecutiveFailures,omitempty"`
	TimeoutSeconds         int  `json:"timeoutSeconds,omitempty"`
	DelaySeconds           int  `json:"delaySeconds"`

	Protocol  string                 `json:"protocol,omitempty"`
	Path      string                 `json:"path,omitempty"`
	PortIndex int                    `json:"portIndex,omitempty"`
	Port      int                    `json:"port,omitempty"`
	Command   *AppHealthCheckCommand `json:"command,omitempty"`
}

type AppHealthCheckCommand

type AppHealthCheckCommand struct {
	Value string `json:"value,omitempty"`
}

type AppIpAddress

type AppIpAddress struct {
	NetworkName string                `json:"networkName"`
	Discovery   AppIpAddressDiscovery `json:"discovery"`
	Groups      []string              `json:"groups"`
	Labels      map[string]string     `json:"labels"`
}

type AppIpAddressDiscovery

type AppIpAddressDiscovery struct {
	Ports []AppIpAddressDiscoveryPort `json:"ports"`
}

type AppIpAddressDiscoveryPort

type AppIpAddressDiscoveryPort struct {
	Number   int    `json:"number,omitempty"`
	Name     int    `json:"name,omitempty"`
	Protocol string `json:"protocol,omitempty"`
}

type AppNetwork

type AppNetwork struct {
	Name string `json:"name,omitempty"`
	Mode string `json:"mode,omitempty"`
}

type AppPortDefinition

type AppPortDefinition struct {
	Port     int               `json:"port"`
	Protocol string            `json:"protocol,omitempty"`
	Name     string            `json:"name,omitempty"`
	Labels   map[string]string `json:"labels,omitempty"`
}

type AppReadinessCheck

type AppReadinessCheck struct {
	Name                    string `json:"name,omitempty"`
	Protocol                string `json:"protocol,omitempty"`
	Path                    string `json:"path,omitempty"`
	PortName                string `json:"portName,omitempty"`
	IntervalSeconds         int    `json:"intervalSeconds,omitempty"`
	TimeoutSeconds          int    `json:"timeoutSeconds,omitempty"`
	HttpStatusCodesForReady []int  `json:"httpStatusCodesForReady,omitempty"`
	PreserveLastResponse    bool   `json:"preserveLastResponse,omitempty"`
}

type AppSecret

type AppSecret struct {
	Source string `json:"source"`
}

type AppStatus

type AppStatus string
const (
	AppStatusRunning   AppStatus = "Running"
	AppStatusDeploying AppStatus = "Deploying"
	AppStatusSuspended AppStatus = "Suspended"
	AppStatusWaiting   AppStatus = "Waiting"
	AppStatusDelayed   AppStatus = "Delayed"
	AppStatusHealthy   AppStatus = "Healthy"
)

type AppTasks

type AppTasks struct {
	Tasks []Task `json:"tasks,omitempty"`
}

To get every instance info in one app

type AppUpgradeStrategy

type AppUpgradeStrategy struct {
	MaximumOverCapacity   float32 `json:"maximumOverCapacity,omitempty"`
	MinimumHealthCapacity float32 `json:"minimumHealthCapacity,omitempty"`
}

type Constraint

type Constraint []string

func (Constraint) Equal

func (c Constraint) Equal(other Constraint) bool

type Constraints

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

Constraints Used to build & generate marathon constraints label

func NewConstraints

func NewConstraints() Constraints

NewConstraints create Constraints

func (*Constraints) Generate

func (c *Constraints) Generate() []Constraint

Generate Generate Marathon label

func (*Constraints) NewLikeRule

func (c *Constraints) NewLikeRule(tag string) *rule

NewLikeRule add like rule

func (*Constraints) NewUnlikeRule

func (c *Constraints) NewUnlikeRule(tag string) *rule

NewUnlikeRule add unlike rule

type Deployment

type Deployment struct {
	ID           string   `json:"id"`
	AffectedApps []string `json:"affectedApps"`
}

type Deployments

type Deployments []Deployment

type GetErrorResponse

type GetErrorResponse struct {
	Message string `json:"message,omitempty"`
}

type Group

type Group struct {
	Id     string  `json:"id"`
	Apps   []App   `json:"apps"`
	Groups []Group `json:"groups"`
}

type GroupHTTPResult

type GroupHTTPResult struct {
	Group
	GetErrorResponse
}

wrap correct response and error

type GroupPutResponse

type GroupPutResponse struct {
	DeploymentId string                       `json:"deploymentId,omitempty"`
	Version      string                       `json:"version,omitempty"`
	Message      string                       `json:"message,omitempty"`
	Details      []GroupPutResponseDetail     `json:"details,omitempty"`
	Deployments  []GroupPutResponseDeployment `json:"deployments,omitempty"`
}

func (*GroupPutResponse) ToString

func (g *GroupPutResponse) ToString() string

type GroupPutResponseDeployment

type GroupPutResponseDeployment struct {
	Id string `json:"id,omitempty"`
}

type GroupPutResponseDetail

type GroupPutResponseDetail struct {
	Path   string   `json:"path,omitempty"`
	Errors []string `json:"errors,omitempty"`
}

type HealthCheckResult

type HealthCheckResult struct {
	Alive bool `json:"alive,omitempty"`
}

type InstanceIpAddr

type InstanceIpAddr struct {
	InstanceIp string `json:"ipAddress,omitempty"`
}

type MIpas

type MIpas struct {
	IpAddress string `json:"ipAddress"`
}

type Marathon

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

func (*Marathon) Cancel

func (m *Marathon) Cancel(ctx context.Context, specObj interface{}) (interface{}, error)

func (*Marathon) CapacityInfo

func (m *Marathon) CapacityInfo() apistructs.CapacityInfoData

func (*Marathon) CleanUpBeforeDelete

func (*Marathon) CleanUpBeforeDelete()

func (*Marathon) Create

func (m *Marathon) Create(ctx context.Context, specObj interface{}) (interface{}, error)

func (*Marathon) Destroy

func (m *Marathon) Destroy(ctx context.Context, specObj interface{}) error

func (*Marathon) Inspect

func (m *Marathon) Inspect(ctx context.Context, specObj interface{}) (interface{}, error)

func (*Marathon) JobVolumeCreate

func (*Marathon) JobVolumeCreate(ctx context.Context, spec interface{}) (string, error)

func (*Marathon) KillPod

func (*Marathon) KillPod(podname string) error

func (*Marathon) Kind

func (m *Marathon) Kind() executortypes.Kind

func (*Marathon) Name

func (m *Marathon) Name() executortypes.Name

func (*Marathon) Precheck

func (m *Marathon) Precheck(ctx context.Context, specObj interface{}) (apistructs.ServiceGroupPrecheckData, error)

func (*Marathon) Remove

func (m *Marathon) Remove(ctx context.Context, specObj interface{}) error

func (*Marathon) ResourceInfo

func (m *Marathon) ResourceInfo(brief bool) (apistructs.ClusterResourceInfoData, error)

func (*Marathon) Scale added in v1.0.1

func (*Marathon) Scale(ctx context.Context, spec interface{}) (interface{}, error)

func (*Marathon) SetNodeLabels

func (m *Marathon) SetNodeLabels(setting executortypes.NodeLabelSetting, hosts []string, labels map[string]string) error

func (*Marathon) Status

func (m *Marathon) Status(ctx context.Context, specObj interface{}) (apistructs.StatusDesc, error)

func (*Marathon) SuspendApp

func (m *Marathon) SuspendApp(ch chan string)

Monitor instances that have been killed multiple times within a period of time, and the service to which the instance belongs will be sent here to be executed

func (*Marathon) Update

func (m *Marathon) Update(ctx context.Context, specObj interface{}) (interface{}, error)

Update update marathon group NOTE: If HOST_UNIQUE=true in the updated servicegroup, return an error directly Because after updating the group, the original host may no longer meet the current constraints. And re-obtaining the available host like create will invalidate the blue-green release of the service

func (*Marathon) WaitEvent

func (m *Marathon) WaitEvent(options map[string]string, monitor bool, killedInstanceCh chan string, stopCh chan struct{})

TODO: Re-establish connections in consideration of marathon cluster restarts, exceptions, etc. TODO: Regularly obtain status from marathon api (implemented by aggregation computing layer)

type MarathonInstanceHealthChangedEvent

type MarathonInstanceHealthChangedEvent struct {
	InstanceId string `json:"instanceId"`
	Healthy    bool   `json:"healthy"`
}

type MarathonStatusUpdateEvent

type MarathonStatusUpdateEvent struct {
	TaskStatus  string  `json:"taskStatus"`
	IpAddresses []MIpas `json:"ipAddresses"`
	AppId       string  `json:"appId"`
	TaskId      string  `json:"taskId"`
	Host        string  `json:"host"`
	Message     string  `json:"message"`
}

type ProcessedOffersSummary

type ProcessedOffersSummary struct {
	RejectSummaryLastOffers []RejectSummaryLastOffer `json:"rejectSummaryLastOffers,omitempty"`
}

ProcessedOffersSummary Briefly describe whether the offer is in compliance

type Queue

type Queue struct {
	Queue []QueueOffer `json:"queue,omitempty"`
}

type QueueHTTPResult

type QueueHTTPResult struct {
	Queue
	GetErrorResponse
}

wrap correct response and error

type QueueOffer

type QueueOffer struct {
	Count int             `json:"count,omitempty"`
	Delay QueueOfferDelay `json:"delay,omitempty"`
	App   App             `json:"app,omitempty"`
	// Overview of offer processing
	ProcessedOffersSummary ProcessedOffersSummary `json:"processedOffersSummary,omitempty"`
}

type QueueOfferDelay

type QueueOfferDelay struct {
	TimeLeftSeconds int  `json:"timeLeftSeconds,omitempty"`
	Overdue         bool `json:"overdue,omitempty"`
}

type RejectSummaryLastOffer

type RejectSummaryLastOffer struct {
	Reason    string `json:"reason,omitempty"`
	Declined  int    `json:"declined,omitempty"`
	Processed int    `json:"processed,omitempty"`
}

RejectSummaryLastOffer Describe the failure of the recent offer

type ShortApp

type ShortApp struct {
	Instances int `json:"instances"`
}

type Task

type Task struct {
	Id                  string              `json:"id,omitempty"`
	State               string              `json:"state,omitempty"`
	InstanceIpAddresses []InstanceIpAddr    `json:"ipAddresses,omitempty"`
	Host                string              `json:"host,omitempty"`
	HealthCheckResults  []HealthCheckResult `json:"healthCheckResults,omitempty"`
}

type Ver

type Ver []int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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