Repository navigation
feat(cli): deploy to Cloud Run GPUs with amicu apply - #361
Merged
Merged
Conversation
backend = "cloud_run" in a gcp {} hardware block now works with plan,
apply, destroy, refresh and orphans. A write-ahead record names the
service and its Secret Manager secrets before anything is created;
teardown checks the owner label, deletes, and confirms the service is
gone before state drops the record. The public service is guarded by the
deployment's api_key (vLLM Bearer key, stored in Secret Manager), checked
after deploy, and torn down when the check fails.
# Conflicts: # crates/amicu-cli/src/tests/gcp.rs # web/apps/web/content/docs/providers/gcp.mdx
- Preflight Cloud Run launches for the Cloud Run Admin API, the Secret
Manager API and actAs on the runtime service account before any write.
- Record secrets_unwritten when a fresh start provably wrote no secret, so
teardown can release that record with Secret Manager disabled; written
secrets keep the record.
- orphans treats a disabled Cloud Run API (ServiceDisabled) as no services.
- New gcp { access = "public" | "iam" }: iam keeps Cloud Run's invoker
check (identity token in X-Serverless-Authorization, key in
Authorization); the requireInvokerIam org policy is named with the fix.
- Plan, apply and docs say that any request can start a billed instance on
a public service, capped by max instances.
- Honour profile memory and cpu above the GPU minimum; below it is a
diagnostic. idle_shutdown is Compute Engine only.
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
Wires the Cloud Run GPU library (
amicu-gcpcloudrun) into the CLI:backend = "cloud_run"in agcp {}hardware block now works withplan,apply,destroy,refreshandorphans, alongside Compute Engine.amicu-gcp/src/cloudrun/supervisor.rs):CloudRunRecord(project, region, service, owner marker, secret ids) is written to state before anything is created. Then the API key (andHF_TOKEN) go to Secret Manager, regional, with accessor granted per secret to the runtime service account. Then the service is created and waited on until a revision is ready and/healthanswers. A re-apply tears down the recorded service first, becausecreateadopts an owned service without changing it.destroy.invokerIamDisabledon our own service, no IAM policy change), vLLM'sapi_keyas the Bearer key. UsesGatewayAuth::None, the existing variant for "the runtime key is the only guard". After the deploy, apply checks the endpoint (an anonymous request is refused, the key is accepted), and on failure it deletes the service and secrets this run created./healthwith a 30 min budget.scaling { max_replicas }becomes max instances (default 1), andtarget_concurrencybecomes per-instance concurrency.AMICU-CAP-019now means "a setting Cloud Run cannot honour":zone,machine_type,provisioning,max_run_duration,boot_disk_gb,allowed_source_cidrs,insecure_metadata_secrets,min_replicas > 0,scaledown_window.AMICU-CAP-016covers a missingservice_account/regionandcount != 1.AMICU-CAP-017covers a GPU or region that Cloud Run does not offer (or offers by invitation only).cloud-runbackend.ServiceSpecgainsproject_id(amicu's project id), so the service name and owner marker use amicu's ids rather than the Google project, like the VM path.examples/gcp-cloudrun-l4(Qwen3-0.6B on one L4 in europe-west4, scale to zero) and a Cloud Run section on the GCP docs page.Review follow-ups
actAson the runtime service account (reusing fix(providers): GCP preflight, secret teardown and idle shutdown #360's checks), all before any write.secrets_unwrittenproof as on the VM path: a fresh start that provably wrote no secret can be released when Secret Manager is disabled. Written secrets keep the record.ServiceDisabled) means no services.gcp { access = "public" | "iam" }:iamkeeps Cloud Run's invoker check. Callers send the identity token inX-Serverless-Authorizationand the key inAuthorization. The check after deploy then only verifies that anonymous requests are refused. A violation ofconstraints/run.managed.requireInvokerIamnames the policy and suggestsaccess = "iam".memoryandcpu.coresare honoured above the GPU minimum; below it isAMICU-CAP-016.idle_shutdownis rejected on Cloud Run (AMICU-CAP-019), andaccesson a VM.How tested
cargo test -p amicu-gcp -p amicu-engine -p amicu-core -p amicu-cli --locked(withHF_TOKENunset): all pass. New tests run against an in-memory Cloud Run + Secret Manager API:cargo +stable clippy --workspace --all-targets -- -D warnings,cargo fmt --all --check.Not yet run against Google.
PR title is a conventional commit
Linked issue above
No secrets or private infrastructure details in the diff