Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions pkg/app/piped/platformprovider/ecs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ func (c *client) CreateService(ctx context.Context, service types.Service) (*typ
if service.DeploymentController == nil || service.DeploymentController.Type != types.DeploymentControllerTypeExternal {
return nil, fmt.Errorf("failed to create ECS service %s: deployment controller of type EXTERNAL is required", *service.ServiceName)
}
if service.LaunchType != "" && service.CapacityProviderStrategy != nil {
return nil, fmt.Errorf("failed to create ECS service %s: launch type and capacity provider strategy cannot be specified together", *service.ServiceName)
}
input := &ecs.CreateServiceInput{
Cluster: service.ClusterArn,
ServiceName: service.ServiceName,
Expand All @@ -107,12 +104,6 @@ func (c *client) CreateService(ctx context.Context, service types.Service) (*typ
SchedulingStrategy: service.SchedulingStrategy,
Tags: service.Tags,
}
if service.LaunchType != "" {
input.LaunchType = service.LaunchType
}
if service.CapacityProviderStrategy != nil {
input.CapacityProviderStrategy = service.CapacityProviderStrategy
}
output, err := c.ecsClient.CreateService(ctx, input)
if err != nil {
return nil, fmt.Errorf("failed to create ECS service %s: %w", *service.ServiceName, err)
Expand Down Expand Up @@ -145,9 +136,6 @@ func (c *client) PruneServiceTasks(ctx context.Context, service types.Service) e
}

func (c *client) UpdateService(ctx context.Context, service types.Service) (*types.Service, error) {
if service.LaunchType != "" && service.CapacityProviderStrategy != nil {
return nil, fmt.Errorf("failed to update ECS service %s: launch type and capacity provider strategy cannot be specified together", *service.ServiceName)
}
input := &ecs.UpdateServiceInput{
Cluster: service.ClusterArn,
Service: service.ServiceName,
Expand All @@ -164,10 +152,6 @@ func (c *client) UpdateService(ctx context.Context, service types.Service) (*typ
input.DesiredCount = aws.Int32(service.DesiredCount)
}

if service.CapacityProviderStrategy != nil {
input.CapacityProviderStrategy = service.CapacityProviderStrategy
}

output, err := c.ecsClient.UpdateService(ctx, input)
if err != nil {
return nil, fmt.Errorf("failed to update ECS service %s: %w", *service.ServiceName, err)
Expand Down Expand Up @@ -257,9 +241,6 @@ func (c *client) CreateTaskSet(ctx context.Context, service types.Service, taskD
if taskDefinition.TaskDefinitionArn == nil {
return nil, fmt.Errorf("failed to create task set of task family %s: no task definition provided", *taskDefinition.Family)
}
if service.LaunchType != "" && service.CapacityProviderStrategy != nil {
return nil, fmt.Errorf("failed to create task set of task family %s: launch type and capacity provider strategy cannot be specified together", *taskDefinition.Family)
}

input := &ecs.CreateTaskSetInput{
Cluster: service.ClusterArn,
Expand All @@ -270,18 +251,12 @@ func (c *client) CreateTaskSet(ctx context.Context, service types.Service, taskD
// If you specify the awsvpc network mode, the task is allocated an elastic network interface,
// and you must specify a NetworkConfiguration when run a task with the task definition.
NetworkConfiguration: service.NetworkConfiguration,
LaunchType: service.LaunchType,
ServiceRegistries: service.ServiceRegistries,
}
if service.LaunchType != "" {
input.LaunchType = service.LaunchType
}
if service.CapacityProviderStrategy != nil {
input.CapacityProviderStrategy = service.CapacityProviderStrategy
}
if targetGroup != nil {
input.LoadBalancers = []types.LoadBalancer{*targetGroup}
}

output, err := c.ecsClient.CreateTaskSet(ctx, input)
if err != nil {
return nil, fmt.Errorf("failed to create ECS task set %s: %w", *taskDefinition.TaskDefinitionArn, err)
Expand Down