Skip to content
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
5 changes: 5 additions & 0 deletions lke_node_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type LKENodePool struct {
Label *string `json:"label"`

Autoscaler LKENodePoolAutoscaler `json:"autoscaler"`
FirewallID *int `json:"firewall_id,omitempty"`

// NOTE: Disk encryption may not currently be available to all users.
DiskEncryption InstanceDiskEncryption `json:"disk_encryption,omitempty"`
Expand All @@ -96,6 +97,7 @@ type LKENodePoolCreateOptions struct {
Label *string `json:"label,omitempty"`

Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
FirewallID *int `json:"firewall_id,omitempty"`

// K8sVersion and UpdateStrategy only works for LKE Enterprise to support node pool upgrades.
// It may not currently be available to all users and is under v4beta.
Expand All @@ -112,6 +114,7 @@ type LKENodePoolUpdateOptions struct {
Label *string `json:"label,omitempty"`

Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
FirewallID *int `json:"firewall_id,omitempty"`

// K8sVersion and UpdateStrategy only works for LKE Enterprise to support node pool upgrades.
// It may not currently be available to all users and is under v4beta.
Expand All @@ -131,6 +134,7 @@ func (l LKENodePool) GetCreateOptions() (o LKENodePoolCreateOptions) {
o.K8sVersion = l.K8sVersion
o.UpdateStrategy = l.UpdateStrategy
o.Label = l.Label
o.FirewallID = l.FirewallID

return o
}
Expand All @@ -145,6 +149,7 @@ func (l LKENodePool) GetUpdateOptions() (o LKENodePoolUpdateOptions) {
o.K8sVersion = l.K8sVersion
o.UpdateStrategy = l.UpdateStrategy
o.Label = l.Label
o.FirewallID = l.FirewallID

return o
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/fixtures/lke_e_node_pool_create.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"disk_encryption": "enabled",
"k8s_version": "v1.31.1+lke1",
"update_strategy": "on_recycle",
"label": "custom-label-create"
"label": "custom-label-create",
"firewall_id": 12345
}
3 changes: 2 additions & 1 deletion test/unit/fixtures/lke_e_node_pool_update.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"disk_encryption": "enabled",
"k8s_version": "v1.31.1+lke1",
"update_strategy": "rolling_update",
"label": "custom-label-update"
"label": "custom-label-update",
"firewall_id": 12345
}
4 changes: 4 additions & 0 deletions test/unit/lke_node_pools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func TestLKEEnterpriseNodePool_Create(t *testing.T) {
K8sVersion: linodego.Pointer("v1.31.1+lke1"),
UpdateStrategy: linodego.Pointer(linodego.LKENodePoolOnRecycle),
Label: linodego.Pointer("custom-label-create"),
FirewallID: linodego.Pointer(12345),
}

base.MockPost("lke/clusters/123/pools", fixtureData)
Expand All @@ -212,6 +213,7 @@ func TestLKEEnterpriseNodePool_Create(t *testing.T) {
assert.Equal(t, "v1.31.1+lke1", *nodePool.K8sVersion)
assert.Equal(t, "on_recycle", string(*nodePool.UpdateStrategy))
assert.Equal(t, linodego.Pointer("custom-label-create"), nodePool.Label)
assert.Equal(t, 12345, *nodePool.FirewallID)
}

func TestLKEEnterpriseNodePool_Update(t *testing.T) {
Expand All @@ -226,6 +228,7 @@ func TestLKEEnterpriseNodePool_Update(t *testing.T) {
K8sVersion: linodego.Pointer("v1.31.1+lke1"),
UpdateStrategy: linodego.Pointer(linodego.LKENodePoolRollingUpdate),
Label: linodego.Pointer("custom-label-update"),
FirewallID: linodego.Pointer(12345),
}

base.MockPut("lke/clusters/123/pools/12345", fixtureData)
Expand All @@ -235,4 +238,5 @@ func TestLKEEnterpriseNodePool_Update(t *testing.T) {
assert.Equal(t, "v1.31.1+lke1", *nodePool.K8sVersion)
assert.Equal(t, "rolling_update", string(*nodePool.UpdateStrategy))
assert.Equal(t, linodego.Pointer("custom-label-update"), nodePool.Label)
assert.Equal(t, 12345, *nodePool.FirewallID)
}