[ECS-Plugin]: Implement Primary Rollout and Canary Rollout Stage#6587
Conversation
|
The function // Get current PRIMARY, Active
lp.Infof("Getting current active task sets for the service %s", *service.ServiceName)
prevTaskSets, err := client.GetServiceTaskSets(ctx, service)
if err != nil {
return fmt.Errorf("failed to get service task sets: %w", err)
}
....
lp.Infof("Deleting old task sets for service %s", *service.ServiceName)
for _, prevTaskSet := range prevTaskSets {
if err = client.DeleteTaskSet(ctx, prevTaskSet); err != nil {
return fmt.Errorf("failed to delete old task set %s: %w", *prevTaskSet.TaskSetArn, err)
}
}The stage will handle whether to delete old tasksets or not with stage option |
a8ff36c to
dfec020
Compare
|
After discussing with @khanhtc1202,. we both think that
The old implementation in v0 of pipecd/pkg/app/piped/executor/ecs/ecs.go Lines 378 to 383 in 566fcd6 And this function hides a critical action: delete the old tasksets (which suppose is fine for sync stage but this is dangerous when used inside primary rollout stage because it's not the intend of primary rollout) pipecd/pkg/app/piped/executor/ecs/ecs.go Lines 282 to 291 in 566fcd6 |
b1753bd to
f9b84a5
Compare
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
… tasksets Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
f9b84a5 to
69fdce0
Compare
What this PR does: Implement Primary Rollout and Canary Rollout Stage
Why we need it:
Primary Rollout Stage
sequenceDiagram participant Plugin as ECSPrimaryRolloutStage participant Provider as ECS Client participant ECS as AWS ECS Plugin->>Plugin: Load AppConfig Plugin->>Plugin: Load TaskDefinition Plugin->>Plugin: Load ServiceDefinition Plugin->>Provider: Create ECS client alt AccessType == ELB Plugin->>Plugin: Load primary TargetGroup end Plugin->>Provider: RegisterTaskDefinition Provider->>ECS: RegisterTaskDefinition ECS-->>Provider: TaskDefinition Plugin->>Provider: ApplyServiceDefinition Provider->>ECS: Create/Update Service ECS-->>Provider: Service Plugin->>Provider: GetPrimaryTaskSet Provider->>ECS: DescribeTaskSets ECS-->>Provider: Current Primary TaskSet (or nil) Plugin->>Provider: CreateTaskSet (100% scale) Provider->>ECS: CreateTaskSet ECS-->>Provider: New TaskSet Plugin->>Provider: Promote TaskSet to PRIMARY Provider->>ECS: UpdateServicePrimaryTaskSet alt Previous primary taskset exists Plugin->>Provider: DeleteTaskSet (old primary) Provider->>ECS: DeleteTaskSet end Plugin->>Provider: WaitServiceStable Provider->>ECS: DescribeServices (poll) ECS-->>Provider: Stable Plugin-->>Plugin: StageStatusSuccessCanary Rollout Stage
sequenceDiagram participant Plugin as ECSCanaryRolloutStage participant Provider as ECS Client participant ECS as AWS ECS participant Meta as Metadata Store Plugin->>Plugin: Load AppConfig Plugin->>Plugin: Parse StageOptions (scale) Plugin->>Provider: Create ECS client Plugin->>Plugin: Load TaskDefinition Plugin->>Plugin: Load ServiceDefinition alt AccessType == ELB Plugin->>Plugin: Load TargetGroups alt Canary target group missing Plugin->>Plugin: Log error Plugin-->>Plugin: StageStatusFailure end end Plugin->>Provider: RegisterTaskDefinition Provider->>ECS: RegisterTaskDefinition ECS-->>Provider: TaskDefinition Plugin->>Provider: ApplyServiceDefinition Provider->>ECS: Create/Update Service ECS-->>Provider: Service Plugin->>Provider: CreateTaskSet (canary LB, scale%) Provider->>ECS: CreateTaskSet ECS-->>Provider: New TaskSet Plugin->>Provider: WaitServiceStable Provider->>ECS: DescribeServices (poll) ECS-->>Provider: Stable Plugin->>Meta: PutDeploymentPluginMetadata (canary task set) Plugin-->>Plugin: StageStatusSuccessWhich issue(s) this PR fixes: Part of #6443
Fixes #
Does this PR introduce a user-facing change?: