Skip to content

Commit

Permalink
Add userdata for create nodegroup operation (#73)
Browse files Browse the repository at this point in the history
* add userdata for create nodegroup operation

* docs: expand the description of user data
  • Loading branch information
yaroslaver authored Feb 19, 2024
1 parent f42fc56 commit ce93fd0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/testutils/ptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ func BoolToPtr(v bool) *bool {
func IntToPtr(v int) *int {
return &v
}

// StringToPtr can be used to convert string value to string pointer.
func StringToPtr(v string) *string {
return &v
}
3 changes: 3 additions & 0 deletions pkg/v1/nodegroup/requests_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ type CreateOpts struct {

// AutoscaleMaxNodes represents maximum possible number of worker nodes in the nodegroup.
AutoscaleMaxNodes *int `json:"autoscale_max_nodes,omitempty"`

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

// ResizeOpts represents options for the nodegroup Resize request.
Expand Down
4 changes: 3 additions & 1 deletion pkg/v1/nodegroup/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ const testCreateNodegroupOptsRaw = `
],
"enable_autoscale": true,
"autoscale_min_nodes": 1,
"autoscale_max_nodes": 10
"autoscale_max_nodes": 10,
"user_data": "cGFja2FnZSBtYWluCgppbXBvcnQgImZtdCIKCmZ1bmMgbWFpbigpIHsKCWZtdC5QcmludGxuKCJIZWxsbyIpCn0="
}
}
`
Expand All @@ -224,6 +225,7 @@ var testCreateNodegroupOpts = &nodegroup.CreateOpts{
EnableAutoscale: testutils.BoolToPtr(true),
AutoscaleMinNodes: testutils.IntToPtr(1),
AutoscaleMaxNodes: testutils.IntToPtr(10),
UserData: testutils.StringToPtr("cGFja2FnZSBtYWluCgppbXBvcnQgImZtdCIKCmZ1bmMgbWFpbigpIHsKCWZtdC5QcmludGxuKCJIZWxsbyIpCn0="),
}

// testUpdateNodegroupOptsRaw represents marshalled options for the Update request.
Expand Down

0 comments on commit ce93fd0

Please sign in to comment.