Skip to content

feat: add SFC V2 cloud provider integration (#116)#119

Open
drewmalin wants to merge 7 commits into
mainfrom
sfcv2
Open

feat: add SFC V2 cloud provider integration (#116)#119
drewmalin wants to merge 7 commits into
mainfrom
sfcv2

Conversation

@drewmalin
Copy link
Copy Markdown
Contributor

  • feat: add SFC V2 cloud provider integration

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.

  • refactor(sfcomputev2): consolidate Brev-specific constants into brev_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.

  • refactor(sfcomputev2): clean up provider for correctness and consistency
  • 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
  • chore: swap sfc-go local replace for tagged release v0.1.0-preview

* feat: add SFC V2 cloud provider integration

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>

* refactor(sfcomputev2): consolidate Brev-specific constants into brev_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>

* refactor(sfcomputev2): clean up provider for correctness and consistency

- 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>

* chore: swap sfc-go local replace for tagged release v0.1.0-preview

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@drewmalin drewmalin requested a review from a team as a code owner May 18, 2026 21:08

// BrevProductionImageID is the SFCompute image for Brev production instances
// (ubuntu-24.04.4-cuda-12.8, vm_images.vm_image_id).
BrevProductionImageID = "vmi_4GwEvmclFURy7ztFQjOdr"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manually tested that this image works for us? Docker, UFW, etc?

sfc "github.com/sfcompute/sfc-go"
)

const CloudProviderID = "sfcompute"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok if this collides with the existing cloudcred?

patelspratik
patelspratik previously approved these changes May 18, 2026
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.

3 participants