Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(google_container_node_pool): support gpu driver version #8348

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions mmv1/third_party/terraform/services/container/node_config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,25 @@ func schemaNodeConfig() *schema.Schema {
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
Description: `The accelerator type resource name.`,
},
"gpu_driver_installation_config": &schema.Schema{
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ForceNew: true,
ConfigMode: schema.SchemaConfigModeAttr,
Description: `Configuration for auto installation of GPU driver.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"gpu_driver_version": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `Mode for how the GPU driver is installed.`,
ValidateFunc: validation.StringInSlice([]string{"GPU_DRIVER_VERSION_UNSPECIFIED", "INSTALLATION_DISABLED", "DEFAULT", "LATEST"}, false),
},
},
},
},
"gpu_partition_size": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -648,6 +667,13 @@ func expandNodeConfig(v interface{}) *container.NodeConfig {
GpuPartitionSize: data["gpu_partition_size"].(string),
}

if v, ok := data["gpu_driver_installation_config"]; ok && len(v.([]interface{})) > 0 {
gpuDriverInstallationConfig := data["gpu_driver_installation_config"].([]interface{})[0].(map[string]interface{})
guestAcceleratorConfig.GpuDriverInstallationConfig = &container.GPUDriverInstallationConfig{
GpuDriverVersion: gpuDriverInstallationConfig["gpu_driver_version"].(string),
}
}

if v, ok := data["gpu_sharing_config"]; ok && len(v.([]interface{})) > 0 {
gpuSharingConfig := data["gpu_sharing_config"].([]interface{})[0].(map[string]interface{})
guestAcceleratorConfig.GpuSharingConfig = &container.GPUSharingConfig{
Expand Down Expand Up @@ -1043,6 +1069,13 @@ func flattenContainerGuestAccelerators(c []*container.AcceleratorConfig) []map[s
"type": accel.AcceleratorType,
"gpu_partition_size": accel.GpuPartitionSize,
}
if accel.GpuDriverInstallationConfig != nil {
accelerator["gpu_driver_installation_config"] = []map[string]interface{}{
{
"gpu_driver_version": accel.GpuDriverInstallationConfig.GpuDriverVersion,
},
}
}
if accel.GpuSharingConfig != nil {
accelerator["gpu_sharing_config"] = []map[string]interface{}{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2739,6 +2739,9 @@ resource "google_container_node_pool" "np_with_gpu" {
type = "nvidia-tesla-a100"
gpu_partition_size = "1g.5gb"
count = 1
gpu_driver_installation_config {
gpu_driver_version = "LATEST"
}
gpu_sharing_config {
gpu_sharing_strategy = "TIME_SHARING"
max_shared_clients_per_gpu = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,17 @@ sole_tenant_config {

* `count` (Required) - The number of the guest accelerator cards exposed to this instance.

* `gpu_driver_installation_config` (Optional) - Configuration for auto installation of GPU driver. Structure is [documented below](#nested_gpu_driver_installation_config).

<a name="nested_gpu_driver_installation_config"></a>The `gpu_driver_installation_config` block supports:

* `gpu_driver_version` (Required) - Mode for how the GPU driver is installed.
Accepted values are:
* `"GPU_DRIVER_VERSION_UNSPECIFIED"`: Default value is to not install any GPU driver.
* `"INSTALLATION_DISABLED"`: Disable GPU driver auto installation and needs manual installation.
* `"DEFAULT"`: "Default" GPU driver in COS and Ubuntu.
* `"LATEST"`: "Latest" GPU driver in COS.

* `gpu_partition_size` (Optional) - Size of partitions to create on the GPU. Valid values are described in the NVIDIA mig [user guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).

* `gpu_sharing_config` (Optional) - Configuration for GPU sharing. Structure is [documented below](#nested_gpu_sharing_config).
Expand Down