-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ECS rollback stage does not remove canary created tasks #4465
Conversation
Signed-off-by: ductnn <[email protected]>
// Delete Canary taskSet | ||
canaryTaskSet, ok := in.MetadataStore.Shared().Get(canaryTaskSetARNKeyName) | ||
if !ok { | ||
in.LogPersister.Errorf("Unable to restore CANARY task set to clean: Not found") | ||
return false | ||
} | ||
if err = client.DeleteTaskSet(ctx, *service, canaryTaskSet); err != nil { | ||
in.LogPersister.Errorf("Failed to remove unused previous PRIMARY taskSet %s: %v", canaryTaskSet, err) | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we tried to clean the canary stub by this part, so how about to reuse clean
function?
https://github.com/pipe-cd/pipecd/blob/master/pkg/app/piped/executor/ecs/ecs.go#L349
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Thanks! I'll reuse
clean
function 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khanhtc1202 I fixed it! reuse clean function, please review it 🙏
// Reset routing | ||
routingTrafficCfg := provider.RoutingTrafficConfig{ | ||
{ | ||
TargetGroupArn: *primaryTargetGroup.TargetGroupArn, | ||
Weight: 100, | ||
}, | ||
{ | ||
TargetGroupArn: *canaryTargetGroup.TargetGroupArn, | ||
Weight: 0, | ||
}, | ||
} | ||
|
||
currListenerArns, err := client.GetListenerArns(ctx, *primaryTargetGroup) | ||
if err != nil { | ||
in.LogPersister.Errorf("Failed to get current active listener: %v", err) | ||
return false | ||
} | ||
|
||
if err := client.ModifyListeners(ctx, currListenerArns, routingTrafficCfg); err != nil { | ||
in.LogPersister.Errorf("Failed to routing traffic to CANARY variant: %v", err) | ||
return false | ||
} | ||
|
||
// Delete Canary taskSet | ||
canaryTaskSet, ok := in.MetadataStore.Shared().Get(canaryTaskSetARNKeyName) | ||
if !ok { | ||
in.LogPersister.Errorf("Unable to restore CANARY task set to clean: Not found") | ||
return false | ||
} | ||
if err = client.DeleteTaskSet(ctx, *service, canaryTaskSet); err != nil { | ||
in.LogPersister.Errorf("Failed to remove unused previous PRIMARY taskSet %s: %v", canaryTaskSet, err) | ||
return false | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safer to do this after L182 (after we finish updating the rollbacked taskset as the primary taskset of the current service and remove the previous primary taskset), since it's more sense to only routing the traffic after primary tasksets are well-prepared and ready to handle incoming requests. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You're right, it's a secure choice to proceed 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khanhtc1202 I fixed it! reuse clean function, please review it 🙏
Signed-off-by: ductnn <[email protected]>
|
||
currListenerArns, err := client.GetListenerArns(ctx, *primaryTargetGroup) | ||
if err != nil { | ||
in.LogPersister.Errorf("Failed to get current active listener: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in.LogPersister.Errorf("Failed to get current active listener: %v", err) | |
in.LogPersister.Errorf("Failed to get current active listeners: %v", err) |
nits
} | ||
|
||
if err := client.ModifyListeners(ctx, currListenerArns, routingTrafficCfg); err != nil { | ||
in.LogPersister.Errorf("Failed to routing traffic to CANARY variant: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in.LogPersister.Errorf("Failed to routing traffic to CANARY variant: %v", err) | |
in.LogPersister.Errorf("Failed to routing traffic to PRIMARY variant: %v", err) |
Signed-off-by: ductnn <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you 🙌
* Fix cannot remove canary created task Signed-off-by: ductnn <[email protected]> * Fix reuse clean function Signed-off-by: ductnn <[email protected]> * Update logs message for ECS routing stage rollback Signed-off-by: ductnn <[email protected]> --------- Signed-off-by: ductnn <[email protected]>
* Fix cannot remove canary created task Signed-off-by: ductnn <[email protected]> * Fix reuse clean function Signed-off-by: ductnn <[email protected]> * Update logs message for ECS routing stage rollback Signed-off-by: ductnn <[email protected]> --------- Signed-off-by: ductnn <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]>
) * Update web deps (#4451) Signed-off-by: khanhtc1202 <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Update quickstart to support arm hardware(ex: M1) (#4457) * Add: arch selection for mysql image Update chart values and templates for mysql deployment Signed-off-by: gitbluf <[email protected]> * Update: MySql image selector function to be more descriptive Signed-off-by: gitbluf <[email protected]> * Remove: mysql image set on piped installation Signed-off-by: gitbluf <[email protected]> * Update method name Signed-off-by: gitbluf <[email protected]> --------- Signed-off-by: gitbluf <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Support AWS LoadBalancer with multi listeners (#4462) * Support AWS LoadBalancer with multi listeners Signed-off-by: khanhtc1202 <[email protected]> * Fix go array index Signed-off-by: khanhtc1202 <[email protected]> * Rename symbol Signed-off-by: khanhtc1202 <[email protected]> --------- Signed-off-by: khanhtc1202 <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Specify Version For Templating Tools (#4463) * specify version for templating tools Signed-off-by: Viet Anh Pham Nhu <[email protected]> * Handle Error Both Install Helm And Kustomize Signed-off-by: Viet Anh Pham Nhu <[email protected]> --------- Signed-off-by: Viet Anh Pham Nhu <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Output usage only when flag parsing fails #4381 (#4464) Signed-off-by: Yoshiki Fujikane <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Fix ECS rollback stage does not remove canary created tasks (#4465) * Fix cannot remove canary created task Signed-off-by: ductnn <[email protected]> * Fix reuse clean function Signed-off-by: ductnn <[email protected]> * Update logs message for ECS routing stage rollback Signed-off-by: ductnn <[email protected]> --------- Signed-off-by: ductnn <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Update logs message for ECS routing stage executor (#4466) Signed-off-by: khanhtc1202 <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * fix: update deprecated apiVersion since gke removed (#4469) GoogleCloudPlatform/gke-managed-certs#58 Signed-off-by: hungran <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> * Skip update AppState when no log updates (#4482) Signed-off-by: Kenta Kozuka <[email protected]> --------- Signed-off-by: khanhtc1202 <[email protected]> Signed-off-by: Kenta Kozuka <[email protected]> Signed-off-by: gitbluf <[email protected]> Signed-off-by: Viet Anh Pham Nhu <[email protected]> Signed-off-by: Yoshiki Fujikane <[email protected]> Signed-off-by: ductnn <[email protected]> Signed-off-by: hungran <[email protected]> Co-authored-by: Khanh Tran <[email protected]> Co-authored-by: Marko Petrovic <[email protected]> Co-authored-by: Viet Anh Pham Nhu <[email protected]> Co-authored-by: Yoshiki Fujikane <[email protected]> Co-authored-by: Duc Tran <[email protected]> Co-authored-by: Henry Vu <[email protected]> Co-authored-by: Kurochan <[email protected]>
What this PR does / why we need it:
Cancel with rollback
does not remove canary created tasksWhich issue(s) this PR fixes:
Fixes #4329
Does this PR introduce a user-facing change?: