Skip to content

Comments

Add FluidStack provider boilerplate with comprehensive API stubs#6

Merged
theFong merged 6 commits intomainfrom
devin/1754374679-implement-fluidstack-provider
Aug 5, 2025
Merged

Add FluidStack provider boilerplate with comprehensive API stubs#6
theFong merged 6 commits intomainfrom
devin/1754374679-implement-fluidstack-provider

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Aug 5, 2025

Implement cloud credential pattern for FluidStack provider

Summary

This PR implements the cloud credential pattern for the FluidStack provider to match the established Lambda Labs approach. The key change separates credential management from client operations by introducing a FluidStackCredential struct that implements the CloudCredential interface and creates FluidStackClient instances via MakeClient().

Key Changes:

  • Added FluidStackCredential struct implementing CloudCredential interface with RefID/APIKey fields
  • Updated FluidStackClient constructor to accept both refID and apiKey parameters (was previously just apiKey)
  • Implemented tenant ID generation using SHA256 hash of API key with "fluidstack-" prefix
  • Added capability delegation from credential to client via GetCapabilities() method
  • Confirmed FluidStack image support from API documentation (supports image parameter with default "image://ubuntu22.04")

This addresses GitHub PR feedback from @theFong requesting the cloud credential pattern and clarification on image support.

Review & Testing Checklist for Human

  • Verify interface compliance - Confirm both FluidStackCredential and FluidStackClient properly implement their respective interfaces by running go build ./internal/fluidstack/v1/... and checking for compilation errors
  • Test credential -> client flow - Manually verify that NewFluidStackCredential().MakeClient() creates a working client and that GetReferenceID() returns the correct RefID
  • Compare with Lambda Labs pattern - Side-by-side comparison of internal/fluidstack/v1/client.go vs internal/lambdalabs/v1/client.go to ensure structural consistency
  • Verify GetCapabilities delegation - Test that FluidStackCredential.GetCapabilities() properly delegates to the client without circular dependencies or infinite loops
  • Validate tenant ID generation - Confirm SHA256 hash generation produces consistent, non-empty tenant IDs for the same API key input

Recommended Test Plan: Create a FluidStackCredential instance, call MakeClient(), verify the resulting client has correct RefID, and test that GetCapabilities() works without errors.


Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    subgraph "FluidStack Provider"
        FSClient["internal/fluidstack/v1/<br/>client.go"]:::major-edit
        FSCaps["internal/fluidstack/v1/<br/>capabilities.go"]:::context
        FSInstance["internal/fluidstack/v1/<br/>instance.go"]:::context
        FSInstanceType["internal/fluidstack/v1/<br/>instancetype.go"]:::context
    end

    subgraph "Core Interfaces"
        CloudCred["pkg/v1/client.go<br/>CloudCredential"]:::context
        CloudClient["pkg/v1/client.go<br/>CloudClient"]:::context
    end

    subgraph "Reference Pattern"
        LambdaClient["internal/lambdalabs/v1/<br/>client.go"]:::context
    end

    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end

    FSClient -->|implements| CloudCred
    FSClient -->|implements| CloudClient
    FSClient -->|follows pattern| LambdaClient
    FSClient -->|delegates to| FSCaps

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

  • Pattern Consistency: The implementation follows the exact Lambda Labs credential pattern established in the recent codebase updates
  • Interface Risk: Both FluidStackCredential and FluidStackClient must implement complex interfaces - compilation success is necessary but manual verification of behavior is recommended
  • Delegation Pattern: FluidStackCredential.GetCapabilities() creates a temporary client to fetch capabilities - this should be tested to ensure no circular dependencies
  • Hash Consistency: Tenant ID generation uses the same SHA256 approach as Lambda Labs but should be verified for FluidStack-specific requirements

Session Details: Requested by Alec Fong (@theFong)
Link to Devin run: https://app.devin.ai/sessions/338c2a2ea6d34fd3ba76477ea88c47e6

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Member

@theFong theFong left a comment

Choose a reason for hiding this comment

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

remove all un-useful methods and files.

}
}

func (c *FluidStackClient) GetCapabilities(ctx context.Context) (v1.Capabilities, error) {
Copy link
Member

Choose a reason for hiding this comment

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

lets move this to the capabilities.go and remove the Project capabilities

Copy link
Member

@theFong theFong left a comment

Choose a reason for hiding this comment

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

please remove the unnecessary no implemented functions. Does fluidstack support images?


var _ v1.CloudClient = &FluidStackClient{}

func NewFluidStackClient(apiKey string) *FluidStackClient {
Copy link
Member

Choose a reason for hiding this comment

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

lets make a cloud cred that turns into a client. If you rebase lambda labs you will see how we implemented there.

theFong and others added 5 commits August 5, 2025 21:29
- Implement FluidStackClient with all CloudClient interface methods
- Add project management APIs (create, list, get, delete projects)
- Include comprehensive security documentation with disk encryption analysis
- Document API capabilities and limitations in README
- Follow Lambda Labs provider pattern for consistency
- All methods return v1.ErrNotImplemented as stubs for future implementation

Features:
- Hardware-level disk encryption (self-encrypting drives)
- Project-level network isolation using VXLAN/eBPF
- Instance lifecycle management (create, start, stop, terminate)
- Instance type discovery and tagging support
- Comprehensive compliance certifications (HIPAA, GDPR, ISO27001, SOC 2)

Limitations:
- No individual instance firewall rule management
- Security managed at project/cluster level
- Limited granular network control APIs

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Rename all unused parameters with underscore prefix to satisfy revive linter
- Fix gofumpt formatting issues in client.go struct initialization
- Ensure all CloudClient interface methods comply with linting standards
- All files now pass golangci-lint checks successfully

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Remove unnecessary files: project.go, quota.go, storage.go, image.go, networking.go
- Move GetCapabilities method from client.go to capabilities.go
- Remove Project-related capabilities (create/delete/list/get project)
- Simplify FluidStackClient struct to match Lambda Labs pattern
- Remove unnecessary methods: GetName(), GetRegions(), StartInstance(), StopInstance(), ChangeInstanceType(), UpdateInstanceTags()
- Keep only essential CloudClient interface methods for basic provider functionality

Addresses GitHub PR feedback from @theFong

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Add FluidStackCredential struct implementing CloudCredential interface
- Update FluidStackClient to be created from credential with refID parameter
- Add GetCapabilities method to credential that delegates to client
- Implement GetTenantID with SHA256 hash of API key following Lambda Labs pattern
- Update NewFluidStackClient to accept both refID and apiKey parameters
- Remove GetTenantID from client since it's now handled by credential

Addresses GitHub PR feedback from @theFong about implementing cloud credential pattern.
FluidStack does support images as confirmed from API documentation (image parameter with default 'image://ubuntu22.04').

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
@theFong theFong force-pushed the devin/1754374679-implement-fluidstack-provider branch from fbbd3c1 to 3f554ae Compare August 5, 2025 21:38

// GetCloudProviderID returns the cloud provider ID for FluidStack
func (c *FluidStackCredential) GetCloudProviderID() v1.CloudProviderID {
return "fluidstack"
Copy link
Member

Choose a reason for hiding this comment

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

lets make this a constant

- Add const CloudProviderID = "fluidstack" at package level
- Update both GetCloudProviderID() methods to use the constant
- Update GetTenantID() to use constant in format string for consistency

Addresses GitHub PR comment from @theFong requesting to make the hardcoded "fluidstack" string a constant.

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
@theFong theFong merged commit 2ba871c into main Aug 5, 2025
4 checks passed
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