Documentation ¶
Index ¶
Constants ¶
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 ¶
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 ¶
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 ¶
type EcsInfo struct { Tasks map[string]EcsTask Services map[string]EcsService TaskServiceMap map[string]string }
EcsInfo is exported for test
type EcsService ¶
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 ¶
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 ¶
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
type TaskLabelInfo ¶
TaskLabelInfo is used in return value of GetLabelInfo. Exported for test.