ecs

package
v0.0.0-...-5e4714a Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CdContainerName   = "main"
	DockerRegistry    = "docker.io"
	EcrPublicRegistry = "public.ecr.aws"
	CrunProjectName   = types.ProjectName
)
View Source
const AwsLogsStreamPrefix = CrunProjectName

Variables

This section is empty.

Functions

func FixupFargateConfig

func FixupFargateConfig(vCpu, memoryMiB float64) (cpu CpuUnits, memory MemoryMiB)

func GetCDLogStreamForTaskID

func GetCDLogStreamForTaskID(taskID string) string

func GetLogStreamForTaskID

func GetLogStreamForTaskID(awslogsStreamPrefix, containerName, taskID string) string

func GetTaskID

func GetTaskID(taskArn TaskArn) string

func GetTaskStatus

func GetTaskStatus(ctx context.Context, taskArn TaskArn) error

func PlatformToArchOS

func PlatformToArchOS(platform string) (string, string)

func Query

func Query(ctx context.Context, input LogGroupInput, start, end time.Time, cb func([]LogEvent)) error

func SplitClusterTask

func SplitClusterTask(taskArn TaskArn) (string, string)

func WaitForTask

func WaitForTask(ctx context.Context, taskArn TaskArn, poll time.Duration) error

Types

type AwsEcs

type AwsEcs struct {
	aws.Aws
	BucketName      string
	ClusterName     string
	LogGroupARN     string
	SecurityGroupID string
	Spot            bool
	SubNetID        string
	TaskDefARN      string
	VpcID           string
}

func (*AwsEcs) CreateUploadURL

func (a *AwsEcs) CreateUploadURL(ctx context.Context, name string) (string, error)

func (*AwsEcs) GetTaskArn

func (a *AwsEcs) GetTaskArn(taskID string) (TaskArn, error)

func (*AwsEcs) GetVpcID

func (a *AwsEcs) GetVpcID() string

func (AwsEcs) Info

func (a AwsEcs) Info(ctx context.Context, id TaskArn) (*types.TaskInfo, error)

func (*AwsEcs) MakeARN

func (a *AwsEcs) MakeARN(service, resource string) string

func (*AwsEcs) PopulateVPCandSubnetID

func (a *AwsEcs) PopulateVPCandSubnetID(ctx context.Context, vpcID, subnetID string) error

func (*AwsEcs) Run

func (a *AwsEcs) Run(ctx context.Context, env map[string]string, cmd ...string) (TaskArn, error)

func (AwsEcs) Stop

func (a AwsEcs) Stop(ctx context.Context, id types.TaskID) error

func (*AwsEcs) Tail

func (a *AwsEcs) Tail(ctx context.Context, taskArn TaskArn) error

func (*AwsEcs) TailTaskID

func (a *AwsEcs) TailTaskID(ctx context.Context, taskID string) (EventStream, error)

type Cache

type Cache interface {
	Get(string) string
	Set(string, string)
}
var DeploymentEtags Cache = make(LocalCache)

type CpuUnits

type CpuUnits = uint

type DeploymentStateChangeEvent

type DeploymentStateChangeEvent struct {
	Detail ECSDeploymentStateChange
	// contains filtered or unexported fields
}

func (*DeploymentStateChangeEvent) Etag

func (*DeploymentStateChangeEvent) Host

func (*DeploymentStateChangeEvent) Service

func (e *DeploymentStateChangeEvent) Service() string

func (*DeploymentStateChangeEvent) State

func (*DeploymentStateChangeEvent) Status

func (e *DeploymentStateChangeEvent) Status() string

type ECSDeploymentStateChange

type ECSDeploymentStateChange struct {
	ECSServiceAction
	DeploymentId string `json:"deploymentId,omitempty"`
}

type ECSServiceAction

type ECSServiceAction = ecsserviceaction.ECSServiceAction

type Event

type Event interface {
	Service() string
	Etag() string
	Host() string
	Status() string
	State() defangv1.ServiceState
}

func ParseECSEvent

func ParseECSEvent(b []byte) (Event, error)

type EventStream

type EventStream interface {
	Close() error
	Events() <-chan types.StartLiveTailResponseStream
	Err() error
}

EventStream is an interface that represents a stream of events from a call to StartLiveTail

func TailLogGroup

func TailLogGroup(ctx context.Context, input LogGroupInput) (EventStream, error)

func TailLogGroups

func TailLogGroups(ctx context.Context, since time.Time, logGroups ...LogGroupInput) (EventStream, error)

type KanikoTaskStateChangeEvent

type KanikoTaskStateChangeEvent TaskStateChangeEvent

func (*KanikoTaskStateChangeEvent) Etag

func (*KanikoTaskStateChangeEvent) Host

func (*KanikoTaskStateChangeEvent) Service

func (e *KanikoTaskStateChangeEvent) Service() string

func (*KanikoTaskStateChangeEvent) State

func (*KanikoTaskStateChangeEvent) Status

func (e *KanikoTaskStateChangeEvent) Status() string

type LocalCache

type LocalCache map[string]string

func (LocalCache) Get

func (c LocalCache) Get(k string) string

func (LocalCache) Set

func (c LocalCache) Set(k, v string)

type LogGroupInput

type LogGroupInput struct {
	LogGroupARN           string
	LogStreamNames        []string
	LogStreamNamePrefix   string
	LogEventFilterPattern string
}

LogGroupInput is like cloudwatchlogs.StartLiveTailInput but with only one loggroup and one logstream prefix.

type LogStreamInfo

type LogStreamInfo struct {
	Prefix    string
	Container string
	Firelens  bool
	TaskID    string
}

func GetLogStreamInfo

func GetLogStreamInfo(logStream string) *LogStreamInfo

type MemoryMiB

type MemoryMiB = uint

type ServiceActionEvent

type ServiceActionEvent struct {
	Detail ECSServiceAction
	// contains filtered or unexported fields
}

func (*ServiceActionEvent) Etag

func (e *ServiceActionEvent) Etag() string

func (*ServiceActionEvent) Host

func (e *ServiceActionEvent) Host() string

func (*ServiceActionEvent) Service

func (e *ServiceActionEvent) Service() string

func (*ServiceActionEvent) State

func (*ServiceActionEvent) Status

func (e *ServiceActionEvent) Status() string

type TaskArn

type TaskArn = types.TaskID

type TaskFailure

type TaskFailure struct {
	Reason types.TaskStopCode
	Detail string
}

func (TaskFailure) Error

func (t TaskFailure) Error() string

type TaskStateChangeEvent

type TaskStateChangeEvent struct {
	Detail ECSTaskStateChange
	// contains filtered or unexported fields
}

func (*TaskStateChangeEvent) Etag

func (e *TaskStateChangeEvent) Etag() string

func (*TaskStateChangeEvent) Host

func (e *TaskStateChangeEvent) Host() string

func (*TaskStateChangeEvent) Service

func (e *TaskStateChangeEvent) Service() string

func (*TaskStateChangeEvent) State

func (*TaskStateChangeEvent) Status

func (e *TaskStateChangeEvent) Status() string

Directories

Path Synopsis
cfn

Jump to

Keyboard shortcuts

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