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

Add nvidia device plugin installation option for create and list/get nodegroup operations #75

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
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
Loading