Repository navigation
feat(vanir): add vanir-sandbox Cloud Run service and HTTP orchestrator #6403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,583
−5
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
290d923
feat(vanir): add vanir-sandbox Cloud Run service and HTTP orchestrator
another-rex 07b8131
refactor(vanir): simplify http_generator to a thin OIDC HTTP client
another-rex 04ee8c0
fix(vanir): address PR #6403 review findings
another-rex 3348114
fix(vanir): address GitHub review comments on PR #6403
another-rex ddb9b07
fix(vanir): restrict /tmp and move sandbox root to /run/vanir-sandbox
another-rex 55e89de
chore(vanir): default max-workers to 15 in sandbox mode
another-rex e58ed3b
fix(vanir): drop stale TODOs and add jittered backoff + transport ret…
another-rex 5ba0158
Merge remote-tracking branch 'upstream/master' into vanir-sandbox-pr1
another-rex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| apiVersion: deploy.cloud.google.com/v1 | ||
| kind: DeliveryPipeline | ||
| metadata: | ||
| name: vanir-sandbox | ||
| description: Vanir sandbox Cloud Run pipeline | ||
| serialPipeline: | ||
| stages: | ||
| - targetId: staging-vanir-sandbox | ||
| profiles: [ staging ] | ||
| - targetId: production-vanir-sandbox | ||
| profiles: [ prod ] | ||
| --- | ||
|
|
||
| apiVersion: deploy.cloud.google.com/v1 | ||
| kind: Target | ||
| metadata: | ||
| name: staging-vanir-sandbox | ||
| description: oss-vdb-test vanir-sandbox instance | ||
| run: | ||
| location: projects/oss-vdb-test/locations/us-west2 | ||
| executionConfigs: | ||
| - usages: | ||
| - RENDER | ||
| - DEPLOY | ||
| serviceAccount: deployment@oss-vdb.iam.gserviceaccount.com | ||
| --- | ||
|
|
||
| apiVersion: deploy.cloud.google.com/v1 | ||
| kind: Target | ||
| metadata: | ||
| name: production-vanir-sandbox | ||
| description: oss-vdb vanir-sandbox instance | ||
| run: | ||
| location: projects/oss-vdb/locations/us-west2 | ||
| executionConfigs: | ||
| - usages: | ||
| - RENDER | ||
| - DEPLOY | ||
| serviceAccount: deployment@oss-vdb.iam.gserviceaccount.com |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| apiVersion: serving.knative.dev/v1 | ||
| kind: Service | ||
| metadata: | ||
| name: vanir-sandbox | ||
| annotations: | ||
| run.googleapis.com/ingress: all | ||
| spec: | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| autoscaling.knative.dev/minScale: '0' | ||
| autoscaling.knative.dev/maxScale: '30' | ||
| run.googleapis.com/execution-environment: gen2 | ||
| spec: | ||
| serviceAccountName: vanir-sandbox@oss-vdb.iam.gserviceaccount.com | ||
| containerConcurrency: 1 | ||
| timeoutSeconds: 1800 | ||
| containers: | ||
| - image: vanir-sandbox | ||
| ports: | ||
| - containerPort: 8080 | ||
| startupProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| resources: | ||
| limits: | ||
| cpu: '4' | ||
| memory: 8Gi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| apiVersion: serving.knative.dev/v1 | ||
| kind: Service | ||
| metadata: | ||
| name: vanir-sandbox | ||
| annotations: | ||
| run.googleapis.com/ingress: all | ||
| spec: | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| autoscaling.knative.dev/minScale: '0' | ||
| autoscaling.knative.dev/maxScale: '30' | ||
| run.googleapis.com/execution-environment: gen2 | ||
| spec: | ||
| serviceAccountName: vanir-sandbox@oss-vdb-test.iam.gserviceaccount.com | ||
| containerConcurrency: 1 | ||
| timeoutSeconds: 1800 | ||
| containers: | ||
| - image: vanir-sandbox | ||
| ports: | ||
| - containerPort: 8080 | ||
| startupProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /healthz | ||
| resources: | ||
| limits: | ||
| cpu: '4' | ||
| memory: 8Gi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| apiVersion: skaffold/v3 | ||
| kind: Config | ||
| metadata: | ||
| name: vanir-sandbox | ||
|
|
||
| profiles: | ||
| - name: staging | ||
| manifests: | ||
| rawYaml: | ||
| - run-staging.yaml | ||
|
|
||
| - name: prod | ||
| manifests: | ||
| rawYaml: | ||
| - run-prod.yaml | ||
|
|
||
| deploy: | ||
| cloudrun: {} |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Dedicated zero-privilege service account for the untrusted Vanir sandbox Cloud Run service. | ||
| # Intentionally granted ZERO IAM roles so querying the metadata server yields no GCP permissions. | ||
| resource "google_service_account" "vanir_sandbox" { | ||
| project = var.project_id | ||
| account_id = "vanir-sandbox" | ||
| display_name = "Vanir Sandbox Service Account (zero IAM roles)" | ||
| } | ||
|
|
||
| # Allow CI/CD deployment and Terraform service accounts to attach vanir_sandbox to Cloud Run revisions. | ||
| # This grants permissions ON the service account to deployers, not TO the service account itself. | ||
| resource "google_service_account_iam_member" "vanir_sandbox_deployer_act_as" { | ||
| for_each = toset([ | ||
| for email in var.frontend_deployer_service_account_emails : "serviceAccount:${email}" | ||
| ]) | ||
|
|
||
| service_account_id = google_service_account.vanir_sandbox.name | ||
| role = "roles/iam.serviceAccountUser" | ||
| member = each.value | ||
| } | ||
|
|
||
| # Untrusted Cloud Run Gen2 microVM sandbox for running Vanir signature generation. | ||
| # Note: template is in lifecycle.ignore_changes, so Terraform only bootstraps the initial | ||
| # revision; deployment/clouddeploy/vanir-sandbox/run-{staging,prod}.yaml are the source of | ||
| # truth for runtime settings (zero-IAM SA, Gen2, concurrency=1, and no VPC access). | ||
| resource "google_cloud_run_v2_service" "vanir_sandbox" { | ||
| project = var.project_id | ||
| name = "vanir-sandbox" | ||
| location = "us-west2" | ||
| ingress = "INGRESS_TRAFFIC_ALL" | ||
|
|
||
| depends_on = [google_service_account_iam_member.vanir_sandbox_deployer_act_as] | ||
|
|
||
| template { | ||
| service_account = google_service_account.vanir_sandbox.email | ||
| execution_environment = "EXECUTION_ENVIRONMENT_GEN2" | ||
| max_instance_request_concurrency = 1 | ||
| timeout = "1800s" | ||
|
|
||
| scaling { | ||
| min_instance_count = 0 | ||
| max_instance_count = 30 | ||
| } | ||
|
|
||
| containers { | ||
| image = "gcr.io/oss-vdb/vanir-sandbox:latest" # Placeholder image. | ||
| resources { | ||
| limits = { | ||
| cpu = "4" | ||
| memory = "8Gi" | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| lifecycle { | ||
| ignore_changes = [ | ||
| # To be managed by Cloud Deploy. | ||
| template, | ||
| traffic, | ||
| labels, | ||
| client, | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| # Restrict invocation strictly to the GKE worker service account (never allUsers). | ||
| resource "google_cloud_run_v2_service_iam_member" "vanir_sandbox_invoker" { | ||
| count = var.worker_service_account_email != "" ? 1 : 0 | ||
| project = var.project_id | ||
| location = google_cloud_run_v2_service.vanir_sandbox.location | ||
| name = google_cloud_run_v2_service.vanir_sandbox.name | ||
| role = "roles/run.invoker" | ||
| member = "serviceAccount:${var.worker_service_account_email}" | ||
| } | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.