Skip to content

Commit d9d10af

Browse files
Aaron Walkerwalkafwalka
authored andcommitted
feat(machine-config): harvester gpu support
1 parent e8a3de0 commit d9d10af

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

docs/resources/machine_config_v2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ The following attributes are exported:
224224
* `user_data` - (Optional) UserData content of cloud-init, base64 is supported. If the image does not contain the qemu-guest-agent package, you must install and start qemu-guest-agent using userdata (string)
225225
* `network_data` - (Optional) NetworkData content of cloud-init, base64 is supported (string)
226226
* `vm_affinity` - (Optional) Virtual machine affinity, only base64 format is supported. For Rancher v2.6.7 and above (string)
227+
* `vgpu_info` - (Optional) A JSON string specifying info for the vGPUs e.g. `{\"vGPURequests\":[{\"name\":\"provisioned\",\"deviceName\":\"nvidia.com/NVIDIA_H200-141C\"}]}` (string)
227228

228229
### `linode_config`
229230

rancher2/schema_machine_config_v2_harvester.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ func machineConfigV2HarvesterFields() map[string]*schema.Schema {
122122
Optional: true,
123123
Description: "NetworkData content of cloud-init, base64 is supported",
124124
},
125+
"vgpu_info": {
126+
Type: schema.TypeString,
127+
Optional: true,
128+
Description: "A JSON string specifying info for the vGPUs e.g. `{\"vGPURequests\":[{\"name\":\"provisioned\",\"deviceName\":\"nvidia.com/NVIDIA_H200-141C\"}]}`",
129+
},
125130
}
126131

127132
return s

rancher2/structure_machine_config_v2_harvester.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type machineConfigV2Harvester struct {
3232
NetworkInfo string `json:"networkInfo,omitempty" yaml:"networkInfo,omitempty"`
3333
UserData string `json:"userData,omitempty" yaml:"userData,omitempty"`
3434
NetworkData string `json:"networkData,omitempty" yaml:"networkData,omitempty"`
35+
VGPUInfo string `json:"vgpuInfo,omitempty" yaml:"vgpuInfo,omitempty"`
3536
}
3637

3738
type MachineConfigV2Harvester struct {
@@ -108,6 +109,10 @@ func flattenMachineConfigV2Harvester(in *MachineConfigV2Harvester) []interface{}
108109
obj["network_data"] = in.NetworkData
109110
}
110111

112+
if len(in.VGPUInfo) > 0 {
113+
obj["vgpu_info"] = in.VGPUInfo
114+
}
115+
111116
return []interface{}{obj}
112117
}
113118

@@ -189,5 +194,9 @@ func expandMachineConfigV2Harvester(p []interface{}, source *MachineConfigV2) *M
189194
obj.NetworkData = v
190195
}
191196

197+
if v, ok := in["vgpu_info"].(string); ok && len(v) > 0 {
198+
obj.VGPUInfo = v
199+
}
200+
192201
return obj
193202
}

0 commit comments

Comments
 (0)