-
Notifications
You must be signed in to change notification settings - Fork 79
Make NodePool optional for LKE-E in python sdk #630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a6f0b01
fecccdb
c5fc286
e882652
d3300d9
966859c
9ff2e33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,8 @@ def test_cluster_create_with_acl(self): | |
| self.client.lke.cluster_create( | ||
| "us-mia", | ||
| "test-acl-cluster", | ||
| [self.client.lke.node_pool("g6-nanode-1", 3)], | ||
| "1.29", | ||
| [self.client.lke.node_pool("g6-nanode-1", 3)], | ||
| control_plane=LKEClusterControlPlaneOptions( | ||
| acl=LKEClusterControlPlaneACLOptions( | ||
| enabled=True, | ||
|
|
@@ -41,3 +41,53 @@ def test_cluster_create_with_acl(self): | |
| assert m.call_data["control_plane"]["acl"]["addresses"]["ipv6"] == [ | ||
| "1234::5678" | ||
| ] | ||
|
|
||
| def test_cluster_create_enterprise_without_node_pools(self): | ||
| """ | ||
| Tests that an enterprise LKE cluster can be created without node pools. | ||
| """ | ||
| with self.mock_post("lke/clusters") as m: | ||
| self.client.lke.cluster_create( | ||
| "us-west", | ||
| "test-enterprise-cluster", | ||
| "1.29", | ||
| tier="enterprise", | ||
| ) | ||
|
|
||
| assert m.call_data["region"] == "us-west" | ||
| assert m.call_data["label"] == "test-enterprise-cluster" | ||
| assert m.call_data["k8s_version"] == "1.29" | ||
| assert m.call_data["tier"] == "enterprise" | ||
| assert m.call_data["node_pools"] == [] | ||
|
|
||
| def test_cluster_create_enterprise_case_insensitive(self): | ||
| """ | ||
| Tests that tier comparison is case-insensitive for enterprise tier. | ||
| """ | ||
| with self.mock_post("lke/clusters") as m: | ||
| self.client.lke.cluster_create( | ||
| "us-west", | ||
| "test-enterprise-cluster", | ||
| "1.29", | ||
| tier="ENTERPRISE", | ||
| ) | ||
|
|
||
| assert m.call_data["tier"] == "ENTERPRISE" | ||
|
||
| assert m.call_data["node_pools"] == [] | ||
|
|
||
| def test_cluster_create_standard_without_node_pools_raises_error(self): | ||
| """ | ||
| Tests that creating a standard LKE cluster without node pools raises ValueError. | ||
| """ | ||
| with self.assertRaises(ValueError) as context: | ||
| self.client.lke.cluster_create( | ||
| "us-east", | ||
| "test-standard-cluster", | ||
| "1.29", | ||
| tier="standard", | ||
| ) | ||
|
|
||
| self.assertIn( | ||
| "LKE standard clusters must have at least one node pool", | ||
| str(context.exception), | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we would delay validation like this to the API in SDKs implementation lol, but it's fine here as is.