Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 5 additions & 7 deletions linode_api4/objects/lke.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class LKENodePool(DerivedBase):
properties = {
"id": Property(identifier=True),
"cluster_id": Property(identifier=True),
"label": Property(mutable=True),
"type": Property(slug_relationship=Type),
"disks": Property(),
"disk_encryption": Property(),
Expand Down Expand Up @@ -419,6 +420,7 @@ def node_pool_create(
Union[str, KubeVersion, TieredKubeVersion]
] = None,
update_strategy: Optional[str] = None,
label: str = None,
**kwargs,
):
"""
Expand All @@ -444,23 +446,19 @@ def node_pool_create(
for possible values.

:returns: The new Node Pool
:param label: The name of the node pool.
:type label: str
:rtype: LKENodePool
"""
params = {
"type": node_type,
"label": label,
"count": node_count,
"labels": labels,
"taints": taints,
"k8s_version": k8s_version,
"update_strategy": update_strategy,
}

if labels is not None:
params["labels"] = labels

if taints is not None:
params["taints"] = taints

params.update(kwargs)

result = self._client.post(
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/lke_clusters_18881_pools_456.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"foo": "bar",
"bar": "foo"
},
"label": "example-node-pool",
"type": "g6-standard-4",
"disk_encryption": "enabled"
}
1 change: 1 addition & 0 deletions test/fixtures/lke_clusters_18882_pools_789.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": 789,
"type": "g6-standard-2",
"label": "enterprise-node-pool",
"count": 3,
"nodes": [],
"disks": [],
Expand Down
5 changes: 5 additions & 0 deletions test/unit/objects/lke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_get_pool(self):
assert pool.id == 456
assert pool.cluster_id == 18881
assert pool.type.id == "g6-standard-4"
assert pool.label == "example-node-pool"
assert pool.disk_encryption == InstanceDiskEncryptionType.enabled

assert pool.disks is not None
Expand Down Expand Up @@ -162,6 +163,7 @@ def test_load_node_pool(self):
self.assertEqual(pool.id, 456)
self.assertEqual(pool.cluster_id, 18881)
self.assertEqual(pool.type.id, "g6-standard-4")
self.assertEqual(pool.label, "example-node-pool")
self.assertIsNotNone(pool.disks)
self.assertIsNotNone(pool.nodes)
self.assertIsNotNone(pool.autoscaler)
Expand Down Expand Up @@ -251,6 +253,7 @@ def test_lke_node_pool_update(self):

pool.tags = ["foobar"]
pool.count = 5
pool.label = "testing-label"
pool.autoscaler = {
"enabled": True,
"min": 2,
Expand All @@ -274,6 +277,7 @@ def test_lke_node_pool_update(self):
"min": 2,
"max": 10,
},
"label": "testing-label",
"labels": {
"updated-key": "updated-value",
},
Expand Down Expand Up @@ -546,6 +550,7 @@ def test_cluster_enterprise(self):
pool = LKENodePool(self.client, 789, 18882)
assert pool.k8s_version == "1.31.1+lke1"
assert pool.update_strategy == "rolling_update"
assert pool.label == "enterprise-node-pool"

def test_lke_tiered_version(self):
version = TieredKubeVersion(self.client, "1.32", "standard")
Expand Down