Skip to content

Commit 16b8765

Browse files
Add firewall_id field to node pool structs (#840)
Co-authored-by: rpotla <[email protected]>
1 parent e478ad9 commit 16b8765

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

lke_node_pools.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ type LKENodePool struct {
7575
Label *string `json:"label"`
7676

7777
Autoscaler LKENodePoolAutoscaler `json:"autoscaler"`
78+
FirewallID *int `json:"firewall_id,omitempty"`
7879

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

9899
Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
100+
FirewallID *int `json:"firewall_id,omitempty"`
99101

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

114116
Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
117+
FirewallID *int `json:"firewall_id,omitempty"`
115118

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

135139
return o
136140
}
@@ -145,6 +149,7 @@ func (l LKENodePool) GetUpdateOptions() (o LKENodePoolUpdateOptions) {
145149
o.K8sVersion = l.K8sVersion
146150
o.UpdateStrategy = l.UpdateStrategy
147151
o.Label = l.Label
152+
o.FirewallID = l.FirewallID
148153

149154
return o
150155
}

test/unit/fixtures/lke_e_node_pool_create.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"disk_encryption": "enabled",
1414
"k8s_version": "v1.31.1+lke1",
1515
"update_strategy": "on_recycle",
16-
"label": "custom-label-create"
16+
"label": "custom-label-create",
17+
"firewall_id": 12345
1718
}

test/unit/fixtures/lke_e_node_pool_update.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"disk_encryption": "enabled",
1414
"k8s_version": "v1.31.1+lke1",
1515
"update_strategy": "rolling_update",
16-
"label": "custom-label-update"
16+
"label": "custom-label-update",
17+
"firewall_id": 12345
1718
}

test/unit/lke_node_pools_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ func TestLKEEnterpriseNodePool_Create(t *testing.T) {
201201
K8sVersion: linodego.Pointer("v1.31.1+lke1"),
202202
UpdateStrategy: linodego.Pointer(linodego.LKENodePoolOnRecycle),
203203
Label: linodego.Pointer("custom-label-create"),
204+
FirewallID: linodego.Pointer(12345),
204205
}
205206

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

217219
func TestLKEEnterpriseNodePool_Update(t *testing.T) {
@@ -226,6 +228,7 @@ func TestLKEEnterpriseNodePool_Update(t *testing.T) {
226228
K8sVersion: linodego.Pointer("v1.31.1+lke1"),
227229
UpdateStrategy: linodego.Pointer(linodego.LKENodePoolRollingUpdate),
228230
Label: linodego.Pointer("custom-label-update"),
231+
FirewallID: linodego.Pointer(12345),
229232
}
230233

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

0 commit comments

Comments
 (0)