Skip to content

Add gateway replica statuses and pipeline#3990

Open
jvstme wants to merge 2 commits into
masterfrom
issue_3959_gateway_replica_pipeline
Open

Add gateway replica statuses and pipeline#3990
jvstme wants to merge 2 commits into
masterfrom
issue_3959_gateway_replica_pipeline

Conversation

@jvstme

@jvstme jvstme commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator
  • Introduce gateway replica statuses.
  • Provision and terminate gateway replicas independently from each other, in a separate pipeline.

#3959

Implementation notes

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.

- 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.
@jvstme jvstme requested a review from r4victor June 24, 2026 23:38

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

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"):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now also applies to 0.20.26?

GatewayModel.gateway_compute_id == GatewayComputeModel.id,
),
)
.where(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants