Add gateway replica statuses and pipeline#3990
Open
jvstme wants to merge 2 commits into
Open
Conversation
- Introduce gateway replica statuses. - Provision and terminate gateway replicas independently from each other, in a separate pipeline. In this version, the pipelines have the following responsibilities. Gateway pipeline: - `SUBMITTED` — create replica DB records, transition to `PROVISIONING`; in a future version — create the load balancer (e.g., AWS ALB). - `PROVISIONING` — once all replicas reach `RUNNING`, transition to `RUNNING`; if any replica enters `TERMINATING` or `TERMINATED`, transition to `FAILED`. - `RUNNING`, `FAILED` — delete the gateway if deletion requested and all replicas are `TERMINATED`. Gateway replica pipeline: - `SUBMITTED` — call backend to create the cloud instance, transition to `PROVISIONING` on success, or `TERMINATED` on failure. - `PROVISIONING` — SSH-connect to the instance and configure the gateway, transition to `RUNNING` on success, or `TERMINATING` on failure. - `RUNNING` — nothing to do. - `TERMINATING` — call backend to destroy the cloud instance, transition to `TERMINATED`. - `TERMINATED` — nothing to do. - also `SUBMITTED`, `PROVISIONING`, or `RUNNING` — transition to `TERMINATING` or `TERMINATED` if the gateway is `FAILED` or gateway deletion is requested.
r4victor
reviewed
Jun 26, 2026
Collaborator
There was a problem hiding this comment.
Any particular reason you decided to call a _commit_update() helper on every apply vs splitting process() into processing and apply phases like other pipelines do?
r4victor
reviewed
Jun 26, 2026
| gateway.ip_address = "\n".join(r.hostname for r in gateway.replicas if r.hostname) | ||
| if gateway.hostname is None: | ||
| gateway.hostname = gateway.ip_address | ||
| if client_version == Version("0.20.25"): |
Collaborator
There was a problem hiding this comment.
Now also applies to 0.20.26?
r4victor
reviewed
Jun 26, 2026
| GatewayModel.gateway_compute_id == GatewayComputeModel.id, | ||
| ), | ||
| ) | ||
| .where( |
Collaborator
There was a problem hiding this comment.
I think you need to predicate on GatewayComputeModel.deleted == False to make use of the partial index ix_gateway_computes_pipeline_fetch_q and avoid full scans.
r4victor
approved these changes
Jun 26, 2026
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.
#3959
Implementation notes
In this version, the pipelines have the following responsibilities.
Gateway pipeline:
SUBMITTED— create replica DB records, transition toPROVISIONING; in a future version — create the load balancer (e.g., AWS ALB).PROVISIONING— once all replicas reachRUNNING, transition toRUNNING; if any replica entersTERMINATINGorTERMINATED, transition toFAILED.RUNNING,FAILED— delete the gateway if deletion requested and all replicas areTERMINATED.Gateway replica pipeline:
SUBMITTED— call backend to create the cloud instance, transition toPROVISIONINGon success, orTERMINATEDon failure.PROVISIONING— SSH-connect to the instance and configure the gateway, transition toRUNNINGon success, orTERMINATINGon failure.RUNNING— nothing to do.TERMINATING— call backend to destroy the cloud instance, transition toTERMINATED.TERMINATED— nothing to do.SUBMITTED,PROVISIONING, orRUNNING— transition toTERMINATINGorTERMINATEDif the gateway isFAILEDor gateway deletion is requested.