Add partial GPU allocation support - #9
Open
UdayKemaAviz wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new Terraform resource to perform partial GPU allocation/deallocation for a tenant via the Fabric API, plus supporting client types/methods and an example configuration. It also tightens lifecycle semantics in the existing tenant_servers resource and registers the new resource in the provider.
Changes:
- Added
fabricapi_gpu_allocationsresource with schema and CRUD behavior targetingPOST /fabrics/{fabric}/tenants/{tenant}/gpuAllocations. - Extended the API client with GPU allocation request/response types and a
ModifyGPUAllocationsmethod. - Updated provider registration and added a runnable example for the new resource; improved
tenant_serversreplacement behavior and conflict checks.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/provider/tenant_servers_resource.go | Requires replacement on tenant/fabric changes; skips server conflict checks for shared tenants. |
| internal/provider/provider.go | Registers the new fabricapi_gpu_allocations resource. |
| internal/provider/gpu_allocations_resource.go | Implements the new GPU allocations Terraform resource. |
| internal/provider/client.go | Adds GPU allocation request/response types and API client method. |
| examples/gpu-allocations/main.tf | New example usage of fabricapi_gpu_allocations. |
| examples/gpu-allocations/variables.tf | Inputs for the GPU allocations example. |
| examples/gpu-allocations/terraform.tfvars.example | Sample values for the GPU allocations example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a new Terraform resource for managing partial GPU allocations for tenants, along with supporting changes to the provider and example configuration. The main focus is adding the
fabricapi_gpu_allocationsresource, which enables users to allocate or deallocate specific GPUs on compute nodes for a tenant. Additional changes improve the provider's usability and safety, and update the example and documentation files.New GPU Allocations Resource:
fabricapi_gpu_allocationsto the provider, allowing users to manage GPU allocations for a tenant via the Fabric API. This includes resource schema, CRUD logic, and integration with the provider. [1] [2]API Client and Data Model Enhancements:
GPUOperation,ServerGPUs,GPUAllocationRequest,GPUAllocationResponse) and theModifyGPUAllocationsmethod in the API client to support the new GPU allocation API endpoint.Example and Documentation Updates:
main.tf,variables.tf,terraform.tfvars.example) demonstrating how to use the new GPU allocations resource. [1] [2] [3]Provider and Resource Improvements:
tenant_serversresource to require replacement whentenant_nameorfabric_namechanges, and improved pre-allocation conflict checks to only run for non-shared tenants. [1] [2] [3] [4]These changes collectively enable fine-grained GPU management for tenants and improve resource lifecycle handling in the provider.