diff --git a/pkg/v1/nodegroup/requests_opts.go b/pkg/v1/nodegroup/requests_opts.go index 73c7b24..566cfae 100644 --- a/pkg/v1/nodegroup/requests_opts.go +++ b/pkg/v1/nodegroup/requests_opts.go @@ -59,6 +59,9 @@ type CreateOpts struct { // InstallNvidiaDevicePlugin indicates if nvidia device plugin installation was requested. InstallNvidiaDevicePlugin *bool `json:"install_nvidia_device_plugin,omitempty"` + + // Preemptible indicates if preemptible instances are used. + Preemptible *bool `json:"preemptible,omitempty"` } // ResizeOpts represents options for the nodegroup Resize request. diff --git a/pkg/v1/nodegroup/schemas.go b/pkg/v1/nodegroup/schemas.go index da3d3bc..06258d7 100644 --- a/pkg/v1/nodegroup/schemas.go +++ b/pkg/v1/nodegroup/schemas.go @@ -61,6 +61,9 @@ type BaseView struct { // InstallNvidiaDevicePlugin indicates if nvidia device plugin installation was requested. InstallNvidiaDevicePlugin bool `json:"install_nvidia_device_plugin"` + + // Preemptible indicates if preemptible instances are used. + Preemptible bool `json:"preemptible"` } // ListView represents an unmarshalled nodegroup body from the list API response. diff --git a/pkg/v1/nodegroup/testing/fixtures.go b/pkg/v1/nodegroup/testing/fixtures.go index 7fe41f3..c7f9aad 100644 --- a/pkg/v1/nodegroup/testing/fixtures.go +++ b/pkg/v1/nodegroup/testing/fixtures.go @@ -47,7 +47,8 @@ const testGetNodegroupResponseRaw = ` "autoscale_max_nodes": 0, "nodegroup_type": "STANDARD", "user_data": "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=", - "install_nvidia_device_plugin": false + "install_nvidia_device_plugin": false, + "preemptible": false } } ` @@ -92,6 +93,7 @@ var expectedGetNodegroupResponse = &nodegroup.GetView{ AutoscaleMaxNodes: 0, NodegroupType: "STANDARD", InstallNvidiaDevicePlugin: false, + Preemptible: false, }, UserData: "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=", } @@ -138,7 +140,8 @@ const testListNodegroupsResponseRaw = ` "available_additional_info": { "user_data": true }, - "install_nvidia_device_plugin": false + "install_nvidia_device_plugin": false, + "preemptible": false } ] } @@ -183,6 +186,7 @@ var expectedListNodegroupsResponse = []*nodegroup.ListView{ AutoscaleMaxNodes: 0, NodegroupType: "STANDARD", InstallNvidiaDevicePlugin: false, + Preemptible: false, }, AvailableAdditionalInfo: map[string]bool{"user_data": true}, }, @@ -213,7 +217,8 @@ const testCreateNodegroupOptsRaw = ` "autoscale_min_nodes": 1, "autoscale_max_nodes": 10, "user_data": "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=", - "install_nvidia_device_plugin": false + "install_nvidia_device_plugin": false, + "preemptible": false } } ` @@ -242,6 +247,7 @@ var testCreateNodegroupOpts = &nodegroup.CreateOpts{ AutoscaleMaxNodes: testutils.IntToPtr(10), UserData: "IyEvYmluL2Jhc2ggLXYKYXB0IC15IHVwZGF0ZQphcHQgLXkgaW5zdGFsbCBtdHI=", InstallNvidiaDevicePlugin: testutils.BoolToPtr(false), + Preemptible: testutils.BoolToPtr(false), } // testUpdateNodegroupOptsRaw represents marshalled options for the Update request.