Skip to content

[ECS:Plugin]: Supporting controller type "ECS"#6674

Open
armistcxy wants to merge 5 commits intopipe-cd:masterfrom
armistcxy:ecs-plugin/ecs-controller-type
Open

[ECS:Plugin]: Supporting controller type "ECS"#6674
armistcxy wants to merge 5 commits intopipe-cd:masterfrom
armistcxy:ecs-plugin/ecs-controller-type

Conversation

@armistcxy
Copy link
Copy Markdown
Contributor

What this PR does: This PR adds support for the native ECS deployment controller type by introducing a strategy pattern:

  • provider layer changes:
    • ForceNewDeployment method added to the ECS interface and client struct, it calls UpdateService with ForceNewDeployment: true and forwards DeploymentConfiguration (with the support of AWS SDK v1.78.0 we can specify Strategy: ROLLING, BLUE_GREEN, CANARY, LINEAR so AWS-managed deployment strategies are supported).
    • CreateService and UpdateService now branch on controller type:
      • For EXTERNAL the existing task-set-based path is preserved
      • For ECS controller, additional fields (TaskDefinition, LaunchType, NetworkConfiguration, ServiceRegistries, DeploymentConfiguration) are included in the API call.
  • deployment layer changes:
    • applyServiceDefinition now returns a newlyCreated bool so callers can distinguish create vs. update.
    • New controller.go defines the deploymentController interface with Sync, PrimaryRollout, and Rollback methods, a newDeploymentController(serviceDef) factory, and two concrete implementations:
      • externalController: simply move of the existing task-set-based flow
      • ecsController: register task definition -> inject task def ARN into service -> applyServiceDefinition (create or update) -> call ForceNewDeployment only for existing services (newly created services start their first deployment automatically) -> WaitServiceStable.

Stage comparison

Stage EXTERNAL controller ECS controller
ECS_SYNC task-set flow (unchanged) ForceNewDeployment flow
ECS_PRIMARY_ROLLOUT task-set flow (unchanged) ForceNewDeployment flow
ECS_ROLLBACK task-set flow (unchanged) ForceNewDeployment flow
ECS_CANARY_ROLLOUT supported error
ECS_CANARY_CLEAN supported no-op success
ECS_TRAFFIC_ROUTING supported error

Why we need it: Previously the ECS plugin hard-coded the EXTERNAL deployment controller, this blocks native ECS features such as Service Connect, deployment circuit breakers, and deployment alarms that are only available with the ECS controller type.

Supported features wih ECS controller

Feature Brief Description
Service Connect Native service-to-service discovery and communication mesh managed by ECS; not available with EXTERNAL controller
Deployment Circuit Breaker Automatically detects a failing deployment and triggers a rollback without manual intervention
Deployment Alarms Integrates CloudWatch alarms into the deployment lifecycle — halts or rolls back if an alarm fires during rollout
Rolling Update Strategy AWS gradually replaces old tasks with new ones, controlling minimumHealthyPercent / maximumPercent natively
Blue/Green Strategy Runs the new version alongside the old; cuts over atomically after a configurable bake time
Canary Strategy Shifts a small percentage (CanaryPercent) of traffic to the new version first, then completes the rollout after CanaryBakeTimeInMinutes
Linear Strategy Incrementally increases traffic to the new version in equal steps (StepPercent) at fixed intervals (StepBakeTimeInMinutes)
Bake Time Configurable wait period after a deployment step before AWS declares the deployment stable and proceeds
Application Auto Scaling Auto Scaling adjusts desiredCount in sync with the native ECS deployment lifecycle, avoiding race conditions that arise when scaling interacts with the task-set management of the EXTERNAL controller
Service Registries (Cloud Map) Registers the service with AWS Cloud Map for DNS-based service discovery; properly passed to CreateService / UpdateService for the ECS controller
VPC Lattice Integration Connects the ECS service to a VPC Lattice target group for cross-VPC / cross-account load balancing; requires ECS controller type
Managed Instance Draining Automatically drains tasks from EC2 instances being terminated (scale-in events) without manual intervention; only supported with ECS controller

All deployment strategies (Rolling, Blue/Green, Canary, Linear) are configured via DeploymentConfiguration.Strategy in the service definition (available since aws-sdk-go-v2/service/ecs v1.78.0).

Which issue(s) this PR fixes: Part of #6443

Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
@armistcxy armistcxy force-pushed the ecs-plugin/ecs-controller-type branch from a2f4760 to 55d6cfa Compare April 15, 2026 14:37
Signed-off-by: Hoang Ngo <adlehoang118@gmail.com>
@armistcxy armistcxy force-pushed the ecs-plugin/ecs-controller-type branch from a614ac0 to 322bbb0 Compare April 15, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant