feat(RDGRS-1288): Reusing the existing fucntion to implement graceful shutdown logic #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira Issue
RDGRS-1288
Context / Goal
The Chisel server container runs within AWS ECS Fargate, and during ECS task rotations, containers receive a SIGTERM signal before termination. Previously, the Chisel server did not handle SIGTERM, leading to abrupt shutdowns and potential downtime.
This PR enhances the container behavior by implementing graceful termination upon SIGTERM, ensuring cleanup occurs before exit. While this has not been tested directly in ECS Fargate, validation was performed in a local Kubernetes (k3d) cluster, which exhibits similar container lifecycle behavior, enabling faster iteration and reliable results.
Changes in this PR:
Added signal handling logic to the Chisel server to intercept SIGTERM and shut down cleanly.
Verified behavior in a local k3d Kubernetes cluster simulating ECS termination signals.
Included explanatory comments noting that SIGKILL (kill -9) cannot be handled, as it’s enforced by the OS.
Acceptance Criteria:
Chisel server intercepts SIGTERM and shuts down gracefully.
Behavior tested and confirmed in a local Kubernetes (k3d) environment.
Improves ECS task rotation by reducing downtime and enabling orderly shutdowns.
No handling logic for SIGKILL (expected OS behavior).