ecs

package
v0.50.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelManagedBy   string = "pipecd-dev-managed-by"  // Always be piped.
	LabelPiped       string = "pipecd-dev-piped"       // The id of piped handling this application.
	LabelApplication string = "pipecd-dev-application" // The application this resource belongs to.
	LabelCommitHash  string = "pipecd-dev-commit-hash" // Hash value of the deployed commit.
	ManagedByPiped   string = "piped"
)

Variables

View Source
var ErrNoTargetGroup = errors.New("no target group")

Functions

func FindArtifactVersions

func FindArtifactVersions(taskDefinition types.TaskDefinition) ([]*model.ArtifactVersion, error)

FindArtifactVersions parses artifact versions from ECS task definition.

func FindImageTag

func FindImageTag(taskDefinition types.TaskDefinition) (string, error)

FindImageTag parses image tag from given ECS task definition.

func IsPipeCDManagedTaskSet added in v0.45.4

func IsPipeCDManagedTaskSet(ts *types.TaskSet) bool

func LoadServiceDefinition

func LoadServiceDefinition(appDir, serviceDefinitionFilename string) (types.Service, error)

LoadServiceDefinition returns ServiceDefinition object from a given service definition file.

func LoadTargetGroups

func LoadTargetGroups(targetGroups config.ECSTargetGroups) (*types.LoadBalancer, *types.LoadBalancer, error)

LoadTargetGroups returns primary & canary target groups according to the defined in pipe definition file.

func LoadTaskDefinition

func LoadTaskDefinition(appDir, taskDefinition string) (types.TaskDefinition, error)

LoadTaskDefinition returns TaskDefinition object from a given task definition file.

func MakeServiceResourceStates added in v0.49.0

func MakeServiceResourceStates(service *types.Service, taskSetTasks map[string][]*types.Task) []*model.ECSResourceState

MakeServiceResourceStates creates ECSResourceStates of Service, TaskSets, and Tasks. `taskSetTasks` is a map of TaskSetArn to Tasks.

func MakeTags added in v0.41.4

func MakeTags(tags map[string]string) []types.Tag

Types

type Client

type Client interface {
	ECS
	ELB
}

Client is wrapper of ECS client.

type DiffRenderOptions added in v0.48.0

type DiffRenderOptions struct {
	// If true, use "diff" command to render.
	UseDiffCommand bool
}

type DiffResult added in v0.48.0

type DiffResult struct {
	Diff *diff.Result
	Old  ECSManifests
	New  ECSManifests
}

func Diff added in v0.48.0

func Diff(old, new ECSManifests, opts ...diff.Option) (*DiffResult, error)

func (*DiffResult) NoChange added in v0.48.0

func (d *DiffResult) NoChange() bool

func (*DiffResult) Render added in v0.48.0

func (d *DiffResult) Render(opt DiffRenderOptions) string

type ECS

type ECS interface {
	ListClusters(ctx context.Context) ([]string, error)
	ServiceExists(ctx context.Context, clusterName string, servicesName string) (bool, error)
	CreateService(ctx context.Context, service types.Service) (*types.Service, error)
	UpdateService(ctx context.Context, service types.Service) (*types.Service, error)
	PruneServiceTasks(ctx context.Context, service types.Service) error
	WaitServiceStable(ctx context.Context, service types.Service) error
	GetServices(ctx context.Context, clusterName string) ([]*types.Service, error)
	GetTaskDefinition(ctx context.Context, taskDefinitionArn string) (*types.TaskDefinition, error)
	RegisterTaskDefinition(ctx context.Context, taskDefinition types.TaskDefinition) (*types.TaskDefinition, error)
	RunTask(ctx context.Context, taskDefinition types.TaskDefinition, clusterArn string, launchType string, awsVpcConfiguration *config.ECSVpcConfiguration, tags []types.Tag) error
	GetTaskSetTasks(ctx context.Context, taskSet types.TaskSet) ([]*types.Task, error)
	GetServiceTaskSets(ctx context.Context, service types.Service) ([]*types.TaskSet, error)
	CreateTaskSet(ctx context.Context, service types.Service, taskDefinition types.TaskDefinition, targetGroup *types.LoadBalancer, scale int) (*types.TaskSet, error)
	DeleteTaskSet(ctx context.Context, taskSet types.TaskSet) error
	UpdateServicePrimaryTaskSet(ctx context.Context, service types.Service, taskSet types.TaskSet) (*types.TaskSet, error)
	TagResource(ctx context.Context, resourceArn string, tags []types.Tag) error
}

type ECSManifests added in v0.48.0

type ECSManifests struct {
	TaskDefinition    *types.TaskDefinition
	ServiceDefinition *types.Service
}

ECSManifests is configurations of ECS task definition and service.

type ECSManifestsCache added in v0.48.0

type ECSManifestsCache struct {
	AppID  string
	Cache  cache.Cache
	Logger *zap.Logger
}

func (ECSManifestsCache) Get added in v0.48.0

func (c ECSManifestsCache) Get(commit string) (ECSManifests, bool)

func (ECSManifestsCache) Put added in v0.48.0

func (c ECSManifestsCache) Put(commit string, sm ECSManifests)

type ELB

type ELB interface {
	GetListenerArns(ctx context.Context, targetGroup types.LoadBalancer) ([]string, error)
	// ModifyListeners modifies the actions of type ActionTypeEnumForward to perform routing traffic
	// to the given target groups. Other actions won't be modified.
	ModifyListeners(ctx context.Context, listenerArns []string, routingTrafficCfg RoutingTrafficConfig) error
}

type Registry

type Registry interface {
	Client(name string, cfg *config.PlatformProviderECSConfig, logger *zap.Logger) (Client, error)
}

Registry holds a pool of aws client wrappers.

func DefaultRegistry

func DefaultRegistry() Registry

DefaultRegistry returns a pool of aws clients and a mutex associated with it.

type RoutingTrafficConfig

type RoutingTrafficConfig []targetGroupWeight

Jump to

Keyboard shortcuts

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