Skip to content

Commit

Permalink
Support QuickSync for ECS Service Discovery
Browse files Browse the repository at this point in the history
Signed-off-by: t-kikuc <[email protected]>
  • Loading branch information
t-kikuc committed Nov 21, 2023
1 parent 2e7cc6c commit 6c80223
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/app/piped/executor/ecs/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package ecs
import (
"context"

"github.com/aws/aws-sdk-go-v2/service/ecs/types"
"github.com/pipe-cd/pipecd/pkg/app/piped/deploysource"
"github.com/pipe-cd/pipecd/pkg/app/piped/executor"
"github.com/pipe-cd/pipecd/pkg/config"
Expand Down Expand Up @@ -97,9 +98,13 @@ func (e *deployExecutor) ensureSync(ctx context.Context) model.StageStatus {
return model.StageStatus_STAGE_FAILURE
}

primary, _, ok := loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
// When the service is not under ELB, target groups are not used.
var primary *types.LoadBalancer = nil
if e.appCfg.Input.IsAccessedViaELB() {
primary, _, ok = loadTargetGroups(&e.Input, e.appCfg, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
}
}

recreate := e.appCfg.QuickSync.Recreate
Expand Down Expand Up @@ -141,7 +146,7 @@ func (e *deployExecutor) ensureCanaryRollout(ctx context.Context) model.StageSta
if !ok {
return model.StageStatus_STAGE_FAILURE
}
servicedefinition, ok := loadServiceDefinition(&e.Input, e.appCfg.Input.ServiceDefinitionFile, e.deploySource)
serviceDefinition, ok := loadServiceDefinition(&e.Input, e.appCfg.Input.ServiceDefinitionFile, e.deploySource)
if !ok {
return model.StageStatus_STAGE_FAILURE
}
Expand All @@ -155,7 +160,7 @@ func (e *deployExecutor) ensureCanaryRollout(ctx context.Context) model.StageSta
return model.StageStatus_STAGE_FAILURE
}

if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, servicedefinition, canary) {
if !rollout(ctx, &e.Input, e.platformProviderName, e.platformProviderCfg, taskDefinition, serviceDefinition, canary) {
return model.StageStatus_STAGE_FAILURE
}

Expand Down

0 comments on commit 6c80223

Please sign in to comment.