fix(balancer): stop execution after intermediate team provisioning failures - #1287
Open
youknowme19 wants to merge 1 commit into
Open
fix(balancer): stop execution after intermediate team provisioning failures#1287youknowme19 wants to merge 1 commit into
youknowme19 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes an issue where the balancer's team provisioning handlers continued executing subsequent resource provisioning steps after an intermediate failure. The change ensures that execution stops immediately after an error response is sent, preventing duplicate HTTP responses and unnecessary Kubernetes API calls.
Closes #1286
Problem
During team creation, the balancer provisions multiple Kubernetes resources sequentially, including namespaces, ConfigMaps, Secrets, deployments, roles, and role bindings.
If one of the intermediate provisioning steps fails, the corresponding error handler returns a
500 Internal Server Errorresponse but continues executing the remaining provisioning logic. As a result:ERR_HTTP_HEADERS_SENTerrors.This affects the following handlers in
wrongsecrets-balancer/src/teams/teams.js:createTeamcreateAWSTeamcreateAzureTeamcreateGCPTeamRoot Cause
The error handlers for intermediate provisioning steps send an error response but do not terminate the request handler, allowing execution to continue through the remaining provisioning steps.
Solution
Terminate the request handler immediately after sending an error response during any intermediate provisioning failure.
This ensures that:
ERR_HTTP_HEADERS_SENTerrors are avoided.Testing
npm testsuccessfully (38 tests passed).npm run lintsuccessfully (no linting issues).Checklist