From 3c215cc40601d415d042b626d96da3c7feb3e953 Mon Sep 17 00:00:00 2001 From: Khanh Tran <32532742+khanhtc1202@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:14:21 +0700 Subject: [PATCH 1/3] Support create ECS service with serviceRegistries configuration (#4564) Signed-off-by: khanhtc1202 --- pkg/app/piped/platformprovider/ecs/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/app/piped/platformprovider/ecs/client.go b/pkg/app/piped/platformprovider/ecs/client.go index 9e9a009414..ed777fa1d5 100644 --- a/pkg/app/piped/platformprovider/ecs/client.go +++ b/pkg/app/piped/platformprovider/ecs/client.go @@ -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) @@ -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 } @@ -204,6 +205,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} From 63b404b8ab73eb43c91112e46f3d0ee2f97b9c14 Mon Sep 17 00:00:00 2001 From: Khanh Tran <32532742+khanhtc1202@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:31:01 +0700 Subject: [PATCH 2/3] Support update service which contains serviceRegistries (#4567) Signed-off-by: khanhtc1202 --- pkg/app/piped/platformprovider/ecs/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/app/piped/platformprovider/ecs/client.go b/pkg/app/piped/platformprovider/ecs/client.go index ed777fa1d5..5b710ba510 100644 --- a/pkg/app/piped/platformprovider/ecs/client.go +++ b/pkg/app/piped/platformprovider/ecs/client.go @@ -135,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 } From 279ee8151caef3d5a62f6b9be670c2f75d323563 Mon Sep 17 00:00:00 2001 From: tokku5552 <69064290+tokku5552@users.noreply.github.com> Date: Fri, 25 Aug 2023 19:50:06 +0900 Subject: [PATCH 3/3] fix: ECS WaitService finish before task running (#4568) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: ECS WaitService finish before task running Signed-off-by: 徳田 真之介 * Update pkg/app/piped/platformprovider/ecs/client.go Co-authored-by: Khanh Tran <32532742+khanhtc1202@users.noreply.github.com> Signed-off-by: 徳田 真之介 --------- Signed-off-by: 徳田 真之介 Co-authored-by: Khanh Tran <32532742+khanhtc1202@users.noreply.github.com> --- pkg/app/piped/platformprovider/ecs/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/app/piped/platformprovider/ecs/client.go b/pkg/app/piped/platformprovider/ecs/client.go index 5b710ba510..6008c5832b 100644 --- a/pkg/app/piped/platformprovider/ecs/client.go +++ b/pkg/app/piped/platformprovider/ecs/client.go @@ -252,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)