Add fixed-capacity API workload isolation pools - #97
Add fixed-capacity API workload isolation pools#97Alexey Soldatchenko (soldatchenko) merged 11 commits into
Conversation
Validation completed
|
|
This PR intentionally ports the workload-isolation model introduced in AWS PR #287. The k8s implementation uses Deployments, Services, and GKE Ingress rather than ECS services and ALB target groups, but preserves the same traffic contract: ingestion is isolated from scoring/evals/proxy background work, while all other API traffic remains on the default pool. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1304354ef5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
brianvans (brianvans)
left a comment
There was a problem hiding this comment.
Two last comments re: formatting of the istio virtualservice but not blocking
Co-authored-by: brianvans <1323225+brianvans@users.noreply.github.com>
Co-authored-by: brianvans <1323225+brianvans@users.noreply.github.com>
This adds an opt-in workload-isolation capability for Kubernetes data planes. It creates dedicated API Services for ingestion and background work, while keeping the existing API Service as the default pool.
For existing deployments, upgrading to a chart release that includes this change does not enable workload isolation or change the existing API routing. When
api.workloadIsolation.enabled: false, the chart renders no additional API pools and preserves the default API Deployment and Service behavior.For a new deployment, enabling isolation creates dedicated ingest and background API Deployments and Services. The ingress or gateway must own the public route contract below.
For an existing deployment, use two releases:
api.workloadIsolation.enabledwithapi.workloadIsolation.brainstoreAiProxyToBackground: false. Keep classified public paths on the default Service; when using the chart's Istio VirtualService, keepvirtualService.workloadIsolation.enabled: false. Verify the dedicated workloads and Services are healthy.brainstoreAiProxyToBackground: truein a later release. When the chart owns an Istio VirtualService, also setvirtualService.workloadIsolation.enabled: true. This moves the classified public paths and Brainstore's internal scoring/function traffic to the isolated pools.This feature uses fixed replica counts; it does not configure HPA or other autoscaling behavior.
Route contract
The product-owned, machine-readable contract is
braintrust/files/contracts/api-workload-isolation-routes.yaml.An external ingress or gateway must keep
braintrust-apias the fallback backend and route this path set to the dedicated Services. The chart-managed Istio VirtualService can opt into this same contract withvirtualService.workloadIsolation.enabled: true; generated routes are ordered before the user'svirtualService.httprules.braintrust-api(default)braintrust-api-ingestPOST /logs3,POST /otel/v1/traces,POST /attachment,POST /attachment/statusbraintrust-api-backgroundPOST /v1/eval,POST /v1/eval/*,POST /function/eval,POST /function/sandbox,POST /function/use,POST /function/invoke-async-batch,POST /function/insert-functions,POST /automation/logs/trigger, plus all methods for/v1/proxy/chat/completionsand/v1/proxy/responsesThe Istio implementation preserves those AWS path and method boundaries: it renders exact
/v1/evalplus prefix/v1/eval/, so it does not classify a future/v1/evaluateroute. GKE Ingress is path-based rather than method-aware, so its matching paths are deliberately isolated for all HTTP methods; KubernetesPrefix: /v1/evalhas the same exact-and-subpath boundary.Rollback
First route the isolated public paths and Brainstore's internal proxy target back to the default API Service, then verify it is serving them. For a chart-managed Istio VirtualService, disable
virtualService.workloadIsolation.enabledas part of that reroute. Only then disable API workload isolation in the chart.Validation
./test.shpassed: 286 Helm unit tests, Azure/GCP/AWS/minimal renders, and strict lint.mainwhen workload isolation is disabled.terraform testpassed in the GKE app module: 8 passed, including default routing, staged routing (including the retained Brainstore default target), and invalid route-without-pools coverage.