Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
69ac117
LKE Node Pools: add isolation and disk encryption options
aweingarten Mar 5, 2026
5014268
LKE Cluster: add RuleSetIDs for enterprise cluster creation with tests
aweingarten Mar 5, 2026
c1931f6
Add Version field to Firewall and FirewallRuleSet structs with test c…
aweingarten Mar 5, 2026
271eb30
Add GetPrefixListByName helper with test coverage
aweingarten Mar 5, 2026
b9109e3
Merge branch 'main' into rulesets-nodepool-isolation
zliang-akamai Apr 11, 2026
09e747f
Merge branch 'main' into rulesets-nodepool-isolation
zliang-akamai Apr 20, 2026
d6620df
Merge branch 'main' into rulesets-nodepool-isolation
zliang-akamai Jun 3, 2026
9ac25cc
Build fix and format
zliang-akamai Jun 3, 2026
3a330a2
Fix JSON omitzero tag for LKENodePoolIsolation field
zliang-akamai Jun 3, 2026
e0f5b37
Add LKENodePoolIsolationCreateOptions and LKENodePoolIsolationUpdateO…
zliang-akamai Jun 3, 2026
e7be7ca
Clarify JSON omitzero usage for optional fields in create and update …
zliang-akamai Jun 3, 2026
1d69391
Remove LKECluster RuleSetIDs and Firewall Version fields
zliang-akamai Jun 3, 2026
a2ab3e9
Deep clean of firewall version and cluster rules set things
zliang-akamai Jun 3, 2026
8dccc6d
Apply suggestions from code review
zliang-akamai Jun 4, 2026
d899620
Add isolation options to node pool create and update fixtures; update…
zliang-akamai Jun 4, 2026
27d6b84
Apply suggestions from code review
zliang-akamai Jun 4, 2026
3dde26c
Add availability notes
zliang-akamai Jun 4, 2026
c9b0ecc
Remove isolation options from LKENodePool update options and related …
zliang-akamai Jun 5, 2026
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: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
- `NewClient` reads `LINODE_URL`, `LINODE_API_VERSION`, `LINODE_CA`, and `LINODE_DEBUG`; `NewClientFromEnv` prefers `LINODE_TOKEN` over config-file profiles.

## Conventions And Gotchas
- Many option structs use `json:",omitzero"`; use pointers for fields that must serialize explicit zero values.
- Optional fields in create or update options structs must use `json:",omitzero"`.
- Optional fields in create or update options structs must be pointer types so explicit zero values can be serialized when needed.
- List APIs mutate the supplied `*ListOptions` with `Page`, `Pages`, and `Results`; do not reuse one `ListOptions` across list calls.
Comment thread
zliang-akamai marked this conversation as resolved.
- Use `formatAPIPath` for endpoint paths with user-provided string path segments so path escaping matches the client helpers.
- CI enforces PR titles like `TPT-1234: Description` unless labels exempt the PR (`dependencies`, `hotfix`, `community-contribution`, `ignore-for-release`).
Expand Down
25 changes: 25 additions & 0 deletions lke_node_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ type LKENodePoolTaint struct {
Effect LKENodePoolTaintEffect `json:"effect"`
}

// LKENodePoolIsolation controls network isolation for nodes in the pool.
type LKENodePoolIsolation struct {
PublicIPv4 bool `json:"public_ipv4"`
PublicIPv6 bool `json:"public_ipv6"`
}

// LKENodePoolIsolationCreateOptions controls network isolation for node pool create requests.
type LKENodePoolIsolationCreateOptions struct {
PublicIPv4 *bool `json:"public_ipv4,omitzero"`
PublicIPv6 *bool `json:"public_ipv6,omitzero"`
}

// LKENodePoolLabels represents Kubernetes labels to add to an LKENodePool
type LKENodePoolLabels map[string]string

Expand All @@ -79,6 +91,9 @@ type LKENodePool struct {

DiskEncryption InstanceDiskEncryption `json:"disk_encryption,omitzero"`

// Isolation may not currently be available to all users.
Isolation *LKENodePoolIsolation `json:"isolation"`

// K8sVersion and UpdateStrategy are only for LKE Enterprise to support node pool upgrades.
// It may not currently be available to all users and is under v4beta.
K8sVersion *string `json:"k8s_version,omitzero"`
Expand All @@ -101,6 +116,9 @@ type LKENodePoolCreateOptions struct {
Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitzero"`
FirewallID *int `json:"firewall_id,omitzero"`

// Isolation may not currently be available to all users.
Isolation *LKENodePoolIsolationCreateOptions `json:"isolation,omitzero"`

// 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.
K8sVersion *string `json:"k8s_version,omitzero"`
Expand Down Expand Up @@ -141,6 +159,13 @@ func (l LKENodePool) GetCreateOptions() (o LKENodePoolCreateOptions) {
o.FirewallID = l.FirewallID
o.DiskEncryption = &l.DiskEncryption

if l.Isolation != nil {
o.Isolation = &LKENodePoolIsolationCreateOptions{
PublicIPv4: Pointer(l.Isolation.PublicIPv4),
PublicIPv6: Pointer(l.Isolation.PublicIPv6),
}
}

Comment thread
zliang-akamai marked this conversation as resolved.
return o
}

Expand Down
4 changes: 4 additions & 0 deletions test/unit/firewalls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestFirewall_List(t *testing.T) {
assert.Equal(t, linodego.FirewallStatus("enabled"), firewall.Status)

assert.Equal(t, "DROP", firewall.Rules.InboundPolicy)
assert.Equal(t, 1, firewall.Rules.Version)
assert.Len(t, firewall.Rules.Inbound, 1)

inboundRule := firewall.Rules.Inbound[0]
Expand Down Expand Up @@ -120,6 +121,7 @@ func TestFirewall_Create(t *testing.T) {
assert.NotNil(t, firewall.Rules)
assert.Equal(t, "DROP", firewall.Rules.InboundPolicy)
assert.Equal(t, "DROP", firewall.Rules.OutboundPolicy)
assert.Equal(t, 1, firewall.Rules.Version)

assert.Len(t, firewall.Rules.Inbound, 1)
inboundRule := firewall.Rules.Inbound[0]
Expand Down Expand Up @@ -182,6 +184,7 @@ func TestFirewall_Get(t *testing.T) {
assert.NotNil(t, firewall.Rules)
assert.Equal(t, "DROP", firewall.Rules.InboundPolicy)
assert.Equal(t, "DROP", firewall.Rules.OutboundPolicy)
assert.Equal(t, 1, firewall.Rules.Version)

assert.Len(t, firewall.Rules.Inbound, 1)
inboundRule := firewall.Rules.Inbound[0]
Expand Down Expand Up @@ -236,6 +239,7 @@ func TestFirewall_Update(t *testing.T) {
assert.NotNil(t, firewall.Rules)
assert.Equal(t, "DROP", firewall.Rules.InboundPolicy)
assert.Equal(t, "DROP", firewall.Rules.OutboundPolicy)
assert.Equal(t, 1, firewall.Rules.Version)

assert.Len(t, firewall.Rules.Inbound, 1)
inboundRule := firewall.Rules.Inbound[0]
Expand Down
6 changes: 5 additions & 1 deletion test/unit/fixtures/lke_node_pool_create.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@
"min": 1,
"max": 5
},
"label": "custom-label-create"
"label": "custom-label-create",
"isolation": {
"public_ipv4": true,
"public_ipv6": false
}
}
4 changes: 4 additions & 0 deletions test/unit/fixtures/lke_node_pool_get.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"enabled": true,
"min": 1,
"max": 5
},
"isolation": {
"public_ipv4": true,
"public_ipv6": false
}
}

Comment thread
zliang-akamai marked this conversation as resolved.
6 changes: 5 additions & 1 deletion test/unit/fixtures/lke_node_pool_update.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
"min": 2,
"max": 8
},
"label": "custom-label-update"
"label": "custom-label-update",
"isolation": {
"public_ipv4": false,
"public_ipv6": true
}
}
12 changes: 12 additions & 0 deletions test/unit/lke_node_pools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func TestLKENodePool_Get(t *testing.T) {
assert.Equal(t, 3, nodePool.Count)
assert.Equal(t, []string{"tag1", "tag2"}, nodePool.Tags)
assert.Equal(t, []linodego.LockType{linodego.LockTypeCannotDelete}, nodePool.Locks)
if assert.NotNil(t, nodePool.Isolation) {
assert.True(t, nodePool.Isolation.PublicIPv4)
assert.False(t, nodePool.Isolation.PublicIPv6)
}
}

func TestLKENodePool_Create(t *testing.T) {
Expand All @@ -100,6 +104,10 @@ func TestLKENodePool_Create(t *testing.T) {
Max: 5,
},
Label: &label,
Isolation: &linodego.LKENodePoolIsolationCreateOptions{
PublicIPv4: Ptr(true),
PublicIPv6: Ptr(false),
},
}

base.MockPost("lke/clusters/123/pools", fixtureData)
Expand All @@ -112,6 +120,10 @@ func TestLKENodePool_Create(t *testing.T) {
assert.Equal(t, 1, nodePool.Autoscaler.Min)
assert.Equal(t, 5, nodePool.Autoscaler.Max)
assert.Equal(t, &label, nodePool.Label)
if assert.NotNil(t, nodePool.Isolation) {
assert.True(t, nodePool.Isolation.PublicIPv4)
assert.False(t, nodePool.Isolation.PublicIPv6)
}
}

func TestLKENodePool_Update(t *testing.T) {
Expand Down