Skip to content

Conversation

@rammanoj
Copy link
Contributor

📝 Description

What does this PR do and why is this change necessary?

  • Make node_pools argument in cluster_create optional for LKE-E clusters.

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?

  • Create a standard cluster with below code and ensure that it fails with valueError
from linode_api4 import LinodeClient
from linode_api4.objects import LKECluster, LKENodePool

# creating for a new pool
client = LinodeClient("<token>", "https://api.linode.com/v4beta")
cluster = client.lke.cluster_create(
    label="demo-lke-cluster-pythons",
    region="us-ord",
    kube_version="v1.32",  # optional but recommended
    tier="standard")
print(f"Created cluster with ID: {cluster.id}")

# Output:
(lke-tools) ➜  tmp_python python3 main.py
Traceback (most recent call last):
  File "/Users/rpotla/Desktop/Codebase/test/tmp_python/main.py", line 6, in <module>
    cluster = client.lke.cluster_create(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rpotla/Envs/lke-tools/lib/python3.12/site-packages/linode_api4/groups/lke.py", line 124, in cluster_create
    raise ValueError("LKE standard clusters must have at least one node pool.")
ValueError: LKE standard clusters must have at least one node pool.
  • Create a enterprise cluster with below code and ensure that if suceeds.
from linode_api4 import LinodeClient
from linode_api4.objects import LKECluster, LKENodePool

# creating for a new pool
client = LinodeClient("<token>", "https://api.linode.com/v4beta")
cluster = client.lke.cluster_create(
    label="demo-lke-cluster-pythons",
    region="us-ord",
    kube_version="v1.31.9+lke7",  # optional but recommended
    tier="enterprise")
print(f"Created cluster with ID: {cluster.id}")

# Outputs:
(lke-tools) ➜  tmp_python python3 main.py 
Created cluster with ID: 551042

@rammanoj rammanoj requested a review from a team as a code owner December 30, 2025 17:05
@rammanoj rammanoj requested review from jriddle-linode and vshanthe and removed request for a team December 30, 2025 17:05
@vshanthe vshanthe requested a review from Copilot January 5, 2026 05:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the Python SDK to make the node_pools parameter optional when creating LKE Enterprise clusters, while maintaining the requirement for standard LKE clusters. The change reorders function parameters to place kube_version before node_pools and adds validation logic to enforce that standard clusters must have at least one node pool.

Key changes:

  • Reordered parameters in cluster_create() to move kube_version before node_pools
  • Added validation to require at least one node pool for standard tier clusters
  • Made node_pools optional with an empty list default value

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
linode_api4/groups/lke.py Reordered cluster_create parameters and added validation logic for standard vs enterprise cluster node pool requirements
test/unit/groups/lke_test.py Added comprehensive unit tests for enterprise clusters without node pools and validation error cases
test/unit/objects/lke_test.py Updated test calls to match new parameter order
test/unit/linode_client_test.py Updated test calls to match new parameter order
test/integration/models/lke/test_lke.py Updated integration test fixtures to match new parameter order
test/integration/linode_client/test_linode_client.py Updated integration test to match new parameter order

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rammanoj rammanoj force-pushed the optional-nodepools branch from a3adea0 to 7a7cf5a Compare January 5, 2026 20:48
@rammanoj rammanoj force-pushed the optional-nodepools branch from 7a7cf5a to c5fc286 Compare January 5, 2026 20:50
rammanoj and others added 2 commits January 5, 2026 15:50
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ezilber-akamai ezilber-akamai requested a review from Copilot January 9, 2026 18:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

tier="ENTERPRISE",
)

assert m.call_data["tier"] == "ENTERPRISE"
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test validates case-insensitive tier comparison in the validation logic, but the assertion checks that the tier is passed through as-is to the API. Consider also asserting that node_pools is empty to ensure the validation logic correctly allows enterprise clusters without node pools regardless of case.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Works well locally. Just need to fix the lint error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants