Skip to content

feat: add SFC V2 cloud provider integration#116

Open
andreaanez wants to merge 4 commits intobrevdev:mainfrom
sfcompute:andrea/sfcompute-v2
Open

feat: add SFC V2 cloud provider integration#116
andreaanez wants to merge 4 commits intobrevdev:mainfrom
sfcompute:andrea/sfcompute-v2

Conversation

@andreaanez
Copy link
Copy Markdown

Context

SF Compute recently released a new API currently under preview. The V2 API is fully decoupled from V1, e.g. V2 instances will not interact with V1 nodes.

V2 introduces a capacity-based model: compute is purchased via Orders and filled Orders accumulate in a designated Capacity which holds an allocation schedule of nodes. Instances run on nodes and are specific to a Capacity. Each active Instance occupies one node in its Capacity. Available nodes decrease when an Instance is created and increase when it is terminated.

Description

  • Adds v1/providers/sfcomputev2/ backed by github.com/sfcompute/sfc-go@v0.1.0-preview
  • Available slots = capacity's current node_allocation (from allocation schedule) minus non-terminated instance count
  • User tags stored as native SFC V2 instance tags and returned in v1.Instance.Tags
  • SFCCredentialV2 holds only APIKey + RefID; capacity and image IDs are managed as constants
  • Instances are now created with a public SFC image (Ubuntu-24.04.4 cuda-12.8)
  • TODO: Create a production capacity that the integration can reference when creating instances.

Test

  • go build ./v1/providers/sfcomputev2/... passes

Once workspaces and capacities are configured:

  • TestValidationFunctions passes against staging capacity
  • TestInstanceLifecycleValidation passes against staging capacity (create → list → SSH → terminate)
  • TestValidationFunctions passes against production capacity
  • TestInstanceLifecycleValidation passes against production capacity

andreaanez and others added 4 commits May 4, 2026 00:46
Introduces the sfcomputev2 provider package that talks to the V2 SFC API
via github.com/sfcompute/sfc-go. Uses capacity-based slot tracking to report
availability and native tags for instance metadata instead of name encoding.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…constants.go

Moves tag keys, SSH defaults, and adds production capacity/image IDs to a
dedicated file to separate Brev-specific config from generated SDK usage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Store user tags from attrs.Tags as real SFC V2 instance tags; populate
  v1.Instance.Tags on read, filtering internal Brev metadata keys
- Remove CapacityID/ImageID from SFCCredentialV2 — pull from constants instead,
  with a TODO to source from env vars
- Replace procurementTarget (Procurements.List) with currentCapacityAllocation
  (Capacities.Fetch + AllocationSchedule.Total) for available slot counting
- Count all non-terminated instances (including failed) against capacity
- Fix sfcInstanceToBrevInstance to use sfcLocation constant instead of c.location
- Add CapabilityTags to declared capabilities
- Remove legacy sfcNameToBrevData fallback logic (V1 and V2 are mutually exclusive)
- Remove speculative stageTesting/stageProduction normalization; pass stage through raw
- Add validation_test.go following the same pattern as the V1 provider

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@andreaanez andreaanez requested a review from a team as a code owner May 5, 2026 22:44
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.

1 participant