awsecs

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cluster             = report.ECSCluster
	CreatedAt           = report.ECSCreatedAt
	TaskFamily          = report.ECSTaskFamily
	ServiceDesiredCount = report.ECSServiceDesiredCount
	ServiceRunningCount = report.ECSServiceRunningCount
	ScaleUp             = report.ECSScaleUp
	ScaleDown           = report.ECSScaleDown
)

TaskFamily is the key that stores the task family of an ECS Task

Variables

This section is empty.

Functions

func GetLabelInfo added in v1.2.0

func GetLabelInfo(rpt report.Report) map[string]map[string]*TaskLabelInfo

GetLabelInfo returns map from cluster to map of task arns to task infos. Exported for test.

Types

type EcsClient added in v1.2.0

type EcsClient interface {
	// Returns a EcsInfo struct containing data needed for a report.
	GetInfo([]string) EcsInfo
	// Scales a service up or down by amount
	ScaleService(string, int) error
}

EcsClient is a wrapper around an AWS client that makes all the needed calls and just exposes the final results. We create an interface so we can mock for testing.

type EcsInfo added in v1.2.0

type EcsInfo struct {
	Tasks          map[string]EcsTask
	Services       map[string]EcsService
	TaskServiceMap map[string]string
}

EcsInfo is exported for test

type EcsService added in v1.2.0

type EcsService struct {
	ServiceName string
	// The following values may be stale in a cached copy
	DeploymentIDs     []string
	DesiredCount      int64
	PendingCount      int64
	RunningCount      int64
	TaskDefinitionARN string
}

EcsService describes the parts of ECS services we care about. Services are highly mutable and so we can only cache them on a best-effort basis. We have to refresh referenced (ie. has an associated task) services each report but we avoid re-listing services unless we can't find a service for a task. Exported for test.

type EcsTask added in v1.2.0

type EcsTask struct {
	TaskARN           string
	CreatedAt         time.Time
	TaskDefinitionARN string

	// These started fields are immutable once set, and guaranteed to be set once the task is running,
	// which we know it is because otherwise we wouldn't be looking at it.
	StartedAt time.Time
	StartedBy string // tag or deployment id
}

EcsTask describes the parts of ECS tasks we care about. Since we're caching tasks heavily, we ensure no mistakes by casting into a structure that only contains immutable attributes of the resource. Exported for test.

func (EcsTask) IsServiceManaged added in v1.2.0

func (t EcsTask) IsServiceManaged() bool

IsServiceManaged returns true if the task was started by a service.

type Reporter

type Reporter struct {
	ClientsByCluster map[string]EcsClient // Exported for test
	// contains filtered or unexported fields
}

Reporter implements Tagger, Reporter

func Make added in v1.2.0

func Make(cacheSize int, cacheExpiry time.Duration, clusterRegion string, handlerRegistry *controls.HandlerRegistry, probeID string) Reporter

Make creates a new Reporter

func (Reporter) Name

func (r Reporter) Name() string

Name needed for Tagger, Reporter

func (Reporter) Report

func (Reporter) Report() (report.Report, error)

Report needed for Reporter

func (*Reporter) Stop added in v1.3.0

func (r *Reporter) Stop()

Stop unregisters controls.

func (Reporter) Tag

func (r Reporter) Tag(rpt report.Report) (report.Report, error)

Tag needed for Tagger

type TaskLabelInfo added in v1.2.0

type TaskLabelInfo struct {
	ContainerIDs []string
	Family       string
}

TaskLabelInfo is used in return value of GetLabelInfo. Exported for test.

Jump to

Keyboard shortcuts

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