Skip to content

Commit 09b2dbc

Browse files
make worker IMI configurable in nodegroup resource
Signed-off-by: Rohit Kulkarni <[email protected]>
1 parent 049412d commit 09b2dbc

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

internal/provider/iks_node_group_resource.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func (r *iksNodeGroupResource) Schema(_ context.Context, _ resource.SchemaReques
9595
},
9696
"imiid": schema.StringAttribute{
9797
Computed: true,
98+
Optional: true,
9899
},
99100
"state": schema.StringAttribute{
100101
Computed: true,
@@ -196,6 +197,10 @@ func (r *iksNodeGroupResource) Create(ctx context.Context, req resource.CreateRe
196197
NetworkInterfaceVnetName: vnetResp.Metadata.Name,
197198
})
198199

200+
if !plan.IMIId.IsNull() && !plan.IMIId.IsUnknown() {
201+
inArg.WorkerImiId = plan.IMIId.ValueString()
202+
}
203+
199204
nodeGroupResp, _, err := r.client.CreateIKSNodeGroup(ctx, &inArg, plan.ClusterUUID.ValueString(), false)
200205
if err != nil {
201206
resp.Diagnostics.AddError(

internal/provider/imis_datasource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func filterByInstanceType(allImis []models.ImisModel, values []string, latest bo
236236
func getLatestImi(imisList []models.ImisModel) {
237237
for i := range imisList {
238238
sort.Slice(imisList[i].WorkerImi, func(a, b int) bool {
239-
return imisList[i].WorkerImi[a].ImiName.ValueString() < imisList[i].WorkerImi[b].ImiName.ValueString()
239+
return imisList[i].WorkerImi[a].ImiName.ValueString() > imisList[i].WorkerImi[b].ImiName.ValueString()
240240
})
241241
}
242242
imisList[0].WorkerImi = imisList[0].WorkerImi[:1]

pkg/itacservices/kubernetes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ type IKSNodeGroupCreateRequest struct {
9999
Name string `json:"name"`
100100
ProductType string `json:"instanceType"`
101101
InstanceTypeId string `json:"instancetypeid"`
102+
WorkerImiId string `json:"workerimi"`
102103
SSHKeyNames []SKey `json:"sshkeyname"`
103104
UserDataURL string `json:"userdataurl"`
104105
Vnets []Vnet `json:"vnets"`

0 commit comments

Comments
 (0)