Skip to content

Add partial GPU allocation support - #9

Open
UdayKemaAviz wants to merge 3 commits into
masterfrom
partial-gpu-allocation
Open

Add partial GPU allocation support#9
UdayKemaAviz wants to merge 3 commits into
masterfrom
partial-gpu-allocation

Conversation

@UdayKemaAviz

Copy link
Copy Markdown

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_allocations resource, 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:

  • Added a new resource fabricapi_gpu_allocations to 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:

  • Implemented new data types (GPUOperation, ServerGPUs, GPUAllocationRequest, GPUAllocationResponse) and the ModifyGPUAllocations method in the API client to support the new GPU allocation API endpoint.

Example and Documentation Updates:

  • Added an example Terraform configuration (main.tf, variables.tf, terraform.tfvars.example) demonstrating how to use the new GPU allocations resource. [1] [2] [3]

Provider and Resource Improvements:

  • Registered the new GPU allocations resource in the provider.
  • Updated the tenant_servers resource to require replacement when tenant_name or fabric_name changes, 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_allocations resource with schema and CRUD behavior targeting POST /fabrics/{fabric}/tenants/{tenant}/gpuAllocations.
  • Extended the API client with GPU allocation request/response types and a ModifyGPUAllocations method.
  • Updated provider registration and added a runnable example for the new resource; improved tenant_servers replacement 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.

Comment thread internal/provider/gpu_allocations_resource.go
Comment thread internal/provider/gpu_allocations_resource.go
Comment thread examples/gpu-allocations/main.tf Outdated
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.

2 participants