Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Go SDK support for LKE Enterprise cluster firewall ruleset_ids, and introduces node pool network isolation + disk encryption fields so callers can control public IP assignment and encrypted disks via the API.
Changes:
- Add
RuleSetIDstoLKEClusterfor enterprise service-managed firewall rulesets deserialization. - Add
Isolationto LKE node pool structs/options and propagate it throughGetCreateOptions()/GetUpdateOptions(). - Add
DiskEncryptiontoLKENodePoolCreateOptionsand propagate it throughGetCreateOptions().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lke_clusters.go |
Adds ruleset_ids field + struct for enterprise firewall ruleset ID deserialization. |
lke_node_pools.go |
Adds node pool isolation + create-time disk_encryption support and propagates them into option helpers. |
Comments suppressed due to low confidence (3)
lke_node_pools.go:153
LKENodePool.GetCreateOptions()does not copy the poolTypeintoLKENodePoolCreateOptions(Typeis a required JSON field). This can produce invalid create requests when callers useGetCreateOptions()to recreate/clone an existing pool. Copyl.Typeintoo.Type(and consider whether any other required fields should be mirrored).
func (l LKENodePool) GetCreateOptions() (o LKENodePoolCreateOptions) {
o.Count = l.Count
o.Disks = l.Disks
o.Tags = l.Tags
o.Labels = l.Labels
o.Taints = l.Taints
o.Autoscaler = &l.Autoscaler
o.K8sVersion = l.K8sVersion
o.UpdateStrategy = l.UpdateStrategy
o.Label = l.Label
o.FirewallID = l.FirewallID
o.DiskEncryption = l.DiskEncryption
o.Isolation = l.Isolation
lke_node_pools.go:113
- New
Isolation/DiskEncryptionfields were added to the node pool types/options, but there are no corresponding unit tests asserting request serialization and response deserialization for these fields. Given existing unit coverage for LKE node pools, add tests/fixtures that (1) includeisolationin create + update payloads and (2) verifydisk_encryptionis sent on create and unmarshaled on responses.
Isolation *LKENodePoolIsolation `json:"isolation,omitempty"`
// 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,omitempty"`
UpdateStrategy *LKENodePoolUpdateStrategy `json:"update_strategy,omitempty"`
}
// LKENodePoolCreateOptions fields are those accepted by CreateLKENodePool
type LKENodePoolCreateOptions struct {
Count int `json:"count"`
Type string `json:"type"`
Disks []LKENodePoolDisk `json:"disks"`
Tags []string `json:"tags"`
Labels LKENodePoolLabels `json:"labels"`
Taints []LKENodePoolTaint `json:"taints"`
Label *string `json:"label,omitempty"`
Autoscaler *LKENodePoolAutoscaler `json:"autoscaler,omitempty"`
FirewallID *int `json:"firewall_id,omitempty"`
// NOTE: Disk encryption may not currently be available to all users.
DiskEncryption InstanceDiskEncryption `json:"disk_encryption,omitempty"`
Isolation *LKENodePoolIsolation `json:"isolation,omitempty"`
lke_clusters.go:60
RuleSetIDswas added toLKECluster, but there are no unit tests/fixtures in the current test suite validating (a) unmarshaling whenruleset_idsis present for enterprise clusters and (b) behavior when it is absent. Add unit tests similar to other LKE cluster unmarshal tests to prevent regressions in timestamp masking/custom unmarshaling.
// RuleSetIDs contains the IDs of the service-managed firewall rulesets
// automatically created for LKE Enterprise clusters.
RuleSetIDs *LKEClusterRuleSetIDs `json:"ruleset_ids,omitempty"`
}
// LKEClusterRuleSetIDs contains the inbound and outbound ruleset IDs for an LKE-E cluster.
type LKEClusterRuleSetIDs struct {
Inbound int `json:"inbound"`
Outbound int `json:"outbound"`
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a0d3d6 to
6030012
Compare
6030012 to
271eb30
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
What does this PR do and why is this change necessary?
Adds Go SDK support for three LKE Enterprise features: firewall ruleset IDs on clusters, node pool network isolation, and node pool disk encryption.
LKE Cluster Ruleset IDs
New
LKEClusterRuleSetIDsstruct andRuleSetIDsfield onLKECluster:LKE Enterprise clusters have service-managed firewall rulesets automatically created for them. This field enables deserialization when the API returns them. The companion Terraform provider PR uses
ListFirewallRuleSetsto discover these by label convention.Node Pool Isolation
New
LKENodePoolIsolationstruct withPublicIPv4/PublicIPv6booleans, added toLKENodePool,LKENodePoolCreateOptions, andLKENodePoolUpdateOptions:Allows controlling whether worker nodes get public IPv4/IPv6 addresses. Essential for VPC-only deployments where nodes should have no public IPv4.
Node Pool Disk Encryption
Added
DiskEncryption InstanceDiskEncryptiontoLKENodePoolCreateOptions, reusing the existingInstanceDiskEncryptiontype. Propagated throughGetCreateOptions().Files Changed
lke_clusters.goLKEClusterRuleSetIDsstruct,RuleSetIDsfield onLKEClusterlke_node_pools.goLKENodePoolIsolationstruct,Isolation+DiskEncryptionon pool types and optionstest/unit/lke_clusters_test.gotest/unit/fixtures/lke_cluster_enterprise_create.jsonruleset_ids✔️ How to Test
What are the steps to reproduce the issue or verify the changes?
These are struct/field additions with no behavioral changes to existing functionality. Verify by running the unit tests below.
How do I run the relevant unit tests?