Skip to content

Commit

Permalink
feat: add nvidia device plugin installation option for create and lis…
Browse files Browse the repository at this point in the history
…t/get nodegroup operations
  • Loading branch information
yaroslaver committed Jul 1, 2024
1 parent df0e4b1 commit 9530001
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
3 changes: 3 additions & 0 deletions pkg/v1/nodegroup/requests_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type CreateOpts struct {

// UserData represents base64 data which is used to pass a script that worker nodes run on boot.
UserData string `json:"user_data,omitempty"`

// InstallNvidiaDevicePlugin indicates if nvidia device plugin installation was requested.
InstallNvidiaDevicePlugin *bool `json:"install_nvidia_device_plugin,omitempty"`
}

// ResizeOpts represents options for the nodegroup Resize request.
Expand Down
3 changes: 3 additions & 0 deletions pkg/v1/nodegroup/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ type BaseView struct {

// NodegroupType represents nodegroup type.
NodegroupType string `json:"nodegroup_type"`

// InstallNvidiaDevicePlugin indicates if nvidia device plugin installation was requested.
InstallNvidiaDevicePlugin bool `json:"install_nvidia_device_plugin"`
}

// ListView represents an unmarshalled nodegroup body from the list API response.
Expand Down
44 changes: 25 additions & 19 deletions pkg/v1/nodegroup/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ const testGetNodegroupResponseRaw = `
"enable_autoscale": false,
"autoscale_min_nodes": 0,
"autoscale_max_nodes": 0,
"nodegroup_type": "STANDARD",
"user_data": "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI="
"nodegroup_type": "STANDARD",
"user_data": "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=",
"install_nvidia_device_plugin": false
}
}
`
Expand Down Expand Up @@ -86,10 +87,11 @@ var expectedGetNodegroupResponse = &nodegroup.GetView{
Effect: nodegroup.NoScheduleEffect,
},
},
EnableAutoscale: false,
AutoscaleMinNodes: 0,
AutoscaleMaxNodes: 0,
NodegroupType: "STANDARD",
EnableAutoscale: false,
AutoscaleMinNodes: 0,
AutoscaleMaxNodes: 0,
NodegroupType: "STANDARD",
InstallNvidiaDevicePlugin: false,
},
UserData: "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=",
}
Expand Down Expand Up @@ -133,9 +135,10 @@ const testListNodegroupsResponseRaw = `
"autoscale_min_nodes": 0,
"autoscale_max_nodes": 0,
"nodegroup_type": "STANDARD",
"available_additional_info": {
"user_data": true
}
"available_additional_info": {
"user_data": true
},
"install_nvidia_device_plugin": false
}
]
}
Expand Down Expand Up @@ -175,10 +178,11 @@ var expectedListNodegroupsResponse = []*nodegroup.ListView{
Effect: nodegroup.NoScheduleEffect,
},
},
EnableAutoscale: false,
AutoscaleMinNodes: 0,
AutoscaleMaxNodes: 0,
NodegroupType: "STANDARD",
EnableAutoscale: false,
AutoscaleMinNodes: 0,
AutoscaleMaxNodes: 0,
NodegroupType: "STANDARD",
InstallNvidiaDevicePlugin: false,
},
AvailableAdditionalInfo: map[string]bool{"user_data": true},
},
Expand Down Expand Up @@ -208,7 +212,8 @@ const testCreateNodegroupOptsRaw = `
"enable_autoscale": true,
"autoscale_min_nodes": 1,
"autoscale_max_nodes": 10,
"user_data": "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI="
"user_data": "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=",
"install_nvidia_device_plugin": false
}
}
`
Expand All @@ -232,10 +237,11 @@ var testCreateNodegroupOpts = &nodegroup.CreateOpts{
Effect: nodegroup.NoScheduleEffect,
},
},
EnableAutoscale: testutils.BoolToPtr(true),
AutoscaleMinNodes: testutils.IntToPtr(1),
AutoscaleMaxNodes: testutils.IntToPtr(10),
UserData: "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=",
EnableAutoscale: testutils.BoolToPtr(true),
AutoscaleMinNodes: testutils.IntToPtr(1),
AutoscaleMaxNodes: testutils.IntToPtr(10),
UserData: "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=",
InstallNvidiaDevicePlugin: testutils.BoolToPtr(false),
}

// testUpdateNodegroupOptsRaw represents marshalled options for the Update request.
Expand All @@ -250,7 +256,7 @@ const testUpdateNodegroupOptsRaw = `
}
}`

// testCreateNodegroupOpts represents options for the Update request.
// testUpdateNodegroupOpts represents options for the Update request.
var testUpdateNodegroupOpts = &nodegroup.UpdateOpts{
Labels: map[string]string{
"test-label-key": "test-label-value",
Expand Down

0 comments on commit 9530001

Please sign in to comment.