feat: add SFC V2 cloud provider integration#116
Open
andreaanez wants to merge 4 commits intobrevdev:mainfrom
Open
feat: add SFC V2 cloud provider integration#116andreaanez wants to merge 4 commits intobrevdev:mainfrom
andreaanez wants to merge 4 commits intobrevdev:mainfrom
Conversation
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>
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.
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
v1/providers/sfcomputev2/backed bygithub.com/sfcompute/sfc-go@v0.1.0-previewnode_allocation(from allocation schedule) minus non-terminated instance countv1.Instance.TagsSFCCredentialV2holds onlyAPIKey+RefID; capacity and image IDs are managed as constantsUbuntu-24.04.4cuda-12.8)Test
go build ./v1/providers/sfcomputev2/...passesOnce workspaces and capacities are configured:
TestValidationFunctionspasses against staging capacityTestInstanceLifecycleValidationpasses against staging capacity (create → list → SSH → terminate)TestValidationFunctionspasses against production capacityTestInstanceLifecycleValidationpasses against production capacity