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
12 changes: 10 additions & 2 deletions pkg/app/piped/platformprovider/ecs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func (c *client) CreateService(ctx context.Context, service types.Service) (*typ
PropagateTags: types.PropagateTagsService,
Role: service.RoleArn,
SchedulingStrategy: service.SchedulingStrategy,
ServiceRegistries: service.ServiceRegistries,
Tags: service.Tags,
}
output, err := c.ecsClient.CreateService(ctx, input)
Expand All @@ -110,8 +109,10 @@ func (c *client) CreateService(ctx context.Context, service types.Service) (*typ
// Hack: Since we use EXTERNAL deployment controller, the below configurations are not allowed to be passed
// in CreateService step, but it required in further step (CreateTaskSet step). We reassign those values
// as part of service definition for that purpose.
// ref: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html
output.Service.LaunchType = service.LaunchType
output.Service.NetworkConfiguration = service.NetworkConfiguration
output.Service.ServiceRegistries = service.ServiceRegistries

return output.Service, nil
}
Expand All @@ -134,8 +135,10 @@ func (c *client) UpdateService(ctx context.Context, service types.Service) (*typ
// Hack: Since we use EXTERNAL deployment controller, the below configurations are not allowed to be passed
// in UpdateService step, but it required in further step (CreateTaskSet step). We reassign those values
// as part of service definition for that purpose.
// ref: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html
output.Service.LaunchType = service.LaunchType
output.Service.NetworkConfiguration = service.NetworkConfiguration
output.Service.ServiceRegistries = service.ServiceRegistries

return output.Service, nil
}
Expand Down Expand Up @@ -204,6 +207,7 @@ func (c *client) CreateTaskSet(ctx context.Context, service types.Service, taskD
// and you must specify a NetworkConfiguration when run a task with the task definition.
NetworkConfiguration: service.NetworkConfiguration,
LaunchType: service.LaunchType,
ServiceRegistries: service.ServiceRegistries,
}
if targetGroup != nil {
input.LoadBalancers = []types.LoadBalancer{*targetGroup}
Expand Down Expand Up @@ -248,7 +252,11 @@ func (c *client) WaitServiceStable(ctx context.Context, service types.Service) e
Cluster: service.ClusterArn,
Services: []string{*service.ServiceArn},
}

// Wait before first checking the service state due to the logic checking service
// stable currently is based on `pendingCount`, which could always be `0` when
// the service deployment has started running.
// TODO: Wait until a new task is started instead of sleeping.
time.Sleep(30 * time.Second)
retry := backoff.NewRetry(retryServiceStable, backoff.NewConstant(retryServiceStableInterval))
_, err := retry.Do(ctx, func() (interface{}, error) {
output, err := c.ecsClient.DescribeServices(ctx, input)
Expand Down