Skip to content

Comments

Implement Nebius provider boilerplate#8

Merged
theFong merged 7 commits intomainfrom
devin/1754375634-implement-nebius-provider
Aug 5, 2025
Merged

Implement Nebius provider boilerplate#8
theFong merged 7 commits intomainfrom
devin/1754375634-implement-nebius-provider

Conversation

@devin-ai-integration
Copy link
Contributor

Implement Nebius provider boilerplate

Summary

This PR implements the foundational boilerplate for the Nebius cloud provider in the Brev Cloud SDK, following the established Lambda Labs pattern. The implementation adds complete stub implementations for all CloudClient interface methods, proper credential handling, and updated documentation.

Key Changes:

  • Added github.com/nebius/gosdk dependency
  • Created complete Nebius provider structure in internal/nebius/v1/
  • Implemented NebiusCredential and NebiusClient structs with all required interface methods
  • All methods return ErrNotImplemented as stubs, ready for actual API implementation
  • Updated security and contribution documentation with Nebius-specific setup instructions

Capabilities Declared:

  • Instance lifecycle management (Create, Get, List, Terminate, Stop, Start, Reboot)
  • Advanced features (Firewall, Images, Volume resizing, Tags, User data)
  • Quota and location management

Review & Testing Checklist for Human

  • CRITICAL: Verify Nebius Go SDK API usage - Check that gosdk.New() and gosdk.IAMToken() are the correct way to initialize the SDK with service account credentials. The API may have changed since research.
  • Test compilation in clean environment - Run make lint and make test to ensure no dependency or build issues (linting failed in dev environment due to testify package issues)
  • Verify CloudClient interface compliance - Cross-reference with pkg/v1/client.go to ensure all required interface methods are implemented
  • Review authentication documentation accuracy - Check that JWT-based service account flow described in SECURITY.md matches actual Nebius SDK patterns
  • Test basic client instantiation - Verify NewNebiusClient() can be called without errors (even with dummy credentials)

Recommended Test Plan:

  1. Clean build: go build ./internal/nebius/v1/...
  2. Import check: Try importing and instantiating NebiusCredential in a test file
  3. Interface verification: Use Go's type checking to verify NebiusClient satisfies CloudClient

Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    subgraph "Core SDK"
        client["pkg/v1/client.go<br/>CloudClient interface"]:::context
        instance["pkg/v1/instance.go<br/>Instance types"]:::context
        capabilities["pkg/v1/capabilities.go<br/>Capability definitions"]:::context
    end
    
    subgraph "Nebius Provider (NEW)"
        nclient["internal/nebius/v1/client.go<br/>NebiusClient + NebiusCredential"]:::major-edit
        ninst["internal/nebius/v1/instance.go<br/>Instance management stubs"]:::major-edit
        ncap["internal/nebius/v1/capabilities.go<br/>Nebius capabilities"]:::major-edit
        nnet["internal/nebius/v1/networking.go<br/>Firewall stubs"]:::major-edit
        nimg["internal/nebius/v1/image.go<br/>Image management stubs"]:::major-edit
        nstor["internal/nebius/v1/storage.go<br/>Volume management stubs"]:::major-edit
    end
    
    subgraph "Documentation"
        security["internal/nebius/SECURITY.md<br/>Auth implementation details"]:::minor-edit
        contrib["internal/nebius/CONTRIBUTE.md<br/>Setup instructions"]:::minor-edit
    end
    
    subgraph "Dependencies"
        gomod["go.mod<br/>Added nebius/gosdk"]:::minor-edit
        gosdk["github.com/nebius/gosdk<br/>External dependency"]:::context
    end
    
    client --> nclient
    instance --> ninst
    capabilities --> ncap
    nclient --> gosdk
    gomod --> gosdk
    
    subgraph Legend
        L1["Major Edit"]:::major-edit
        L2["Minor Edit"]:::minor-edit  
        L3["Context/No Edit"]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

  • Link to Devin run: https://app.devin.ai/sessions/7e400ee399d34292a0dc47a816954734
  • Requested by: @theFong (Alec Fong)
  • Implementation approach: Follows exact same pattern as Lambda Labs provider with NotImplCloudClient embedding for graceful handling of unsupported features
  • Authentication: Uses JWT-based service account authentication (needs verification)
  • API Type: Configured as APITypeLocational based on Nebius architecture research
  • Ready for: Actual API implementation to replace stub methods returning ErrNotImplemented

This is foundational work that establishes the complete provider structure. All interface methods are implemented as stubs, making it safe to integrate while actual Nebius API calls are developed incrementally.

@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

@theFong
Copy link
Member

theFong commented Aug 5, 2025

can you fix the and rebase/remake the go.mod/sum

- ✅ **Terminate Instance**: `InstanceService.Delete`
- ✅ **Stop Instance**: `InstanceService.Stop`
- ✅ **Start Instance**: `InstanceService.Start`
- ✅ **Update Instance**: `InstanceService.Update`
Copy link
Member

Choose a reason for hiding this comment

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

what do you update the instance for? Changing name/metadata? how does this fit into the v1/interface


### Instance Updates
- ✅ **Update Instance Tags**: Maps to `UpdateInstanceTags` in CloudClient interface
- ✅ **Change Instance Type**: Maps to `ChangeInstanceType` in CloudClient interface (if supported by Nebius API)
Copy link
Member

Choose a reason for hiding this comment

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

can you verify this?

@devin-ai-integration
Copy link
Contributor Author

@theFong I've verified this by examining the Nebius API documentation:

✅ Change Instance Type IS supported:

  • Nebius InstanceService.Update can modify InstanceSpec
  • ResourcesSpec.preset field (the instance type) has NO IMMUTABLE annotation
  • ResourcesSpec.platform is marked as IMMUTABLE but preset is not
  • This maps to CloudClient's ChangeInstanceType(instanceID, instanceType string) method

Evidence: https://github.com/nebius/api/blob/main/nebius/compute/v1/instance.proto

  • Line ~86: ResourcesSpec.preset has no IMMUTABLE annotation
  • Line ~82: ResourcesSpec.platform is marked [(field_behavior) = IMMUTABLE] but preset is not

I've updated the README to correctly show this as supported and removed the contradictory entry from unsupported features. The latest commit (b98cf90) reflects these corrections.

devin-ai-integration bot and others added 7 commits August 5, 2025 21:41
- Add NebiusCredential and NebiusClient structs following Lambda Labs pattern
- Implement all CloudClient interface methods as stubs returning ErrNotImplemented
- Add comprehensive capabilities declaration for Nebius features
- Update documentation with setup and security implementation details
- Add github.com/nebius/gosdk dependency

Features implemented:
- Instance management (Create, Get, List, Terminate, Stop, Start, Reboot)
- Instance types and quotas
- Image management
- Location management
- Firewall/Security Group management
- Volume management
- Tag management

All methods are currently stubs that return ErrNotImplemented, ready for
actual API implementation in future iterations.

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Replace unused 'ctx context.Context' parameters with '_' in all stub methods
- Run gofumpt formatting to fix code formatting issues
- Addresses CI linting failures in Test and Lint job

All stub methods now properly handle unused context parameters according
to Go linting standards while maintaining interface compliance.

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Replace unused 'args' parameters with '_' in all stub methods
- Replace unused 'instanceID' parameters with '_' in RebootInstance and ListInstances
- Fix unused parameters in networking.go, storage.go, quota.go, instancetype.go
- Ensures complete compliance with Go linting standards for all stub methods
- Addresses all remaining CI Test and Lint failures from job 47393947029

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Document supported features based on Nebius API research
- Include instance management, GPU clusters, images, and quotas
- List unsupported features with explanations
- Follow Lambda Labs README structure for consistency
- Reference official Nebius API documentation and Go SDK

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Add missing github.com/kr/text v0.2.0 dependency found by go mod tidy
- Move github.com/nebius/gosdk from indirect to direct dependency
- Resolves dependency management issues identified in PR review

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Remove misleading 'Update Instance' entry that doesn't map to CloudClient interface
- Add specific 'Instance Updates' section with UpdateInstanceTags and ChangeInstanceType
- Clarify in unsupported features why general instance updates aren't supported
- Addresses GitHub comment about how instance updates fit into v1 interface

Resolves theFong's question about what instance updates are for and how they
map to the CloudClient interface methods.

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Mark 'Change Instance Type' as supported based on API verification
- ResourcesSpec.preset field has no IMMUTABLE annotation in Nebius API
- Remove contradictory entry from unsupported features section
- Add TODO item to verify implementation works correctly

Addresses theFong's verification request on GitHub PR comment.

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
@theFong theFong force-pushed the devin/1754375634-implement-nebius-provider branch from b98cf90 to 8724ea7 Compare August 5, 2025 21:43
@theFong theFong merged commit f65375b 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