Skip to content

Commit c77ec6d

Browse files
TPT-3809: Added DiskEncryption field for LKE Node Pool creation (#670)
* Added DiskEncryption field for LKE Node Pool creation * Address CoPilot suggestions
1 parent c10fadc commit c77ec6d

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

linode_api4/objects/lke.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Base,
99
DerivedBase,
1010
Instance,
11+
InstanceDiskEncryptionType,
1112
JSONObject,
1213
MappedObject,
1314
Property,
@@ -422,6 +423,9 @@ def node_pool_create(
422423
] = None,
423424
update_strategy: Optional[str] = None,
424425
label: str = None,
426+
disk_encryption: Optional[
427+
Union[str, InstanceDiskEncryptionType]
428+
] = None,
425429
**kwargs,
426430
):
427431
"""
@@ -443,6 +447,9 @@ def node_pool_create(
443447
:param update_strategy: The strategy to use when updating this node pool.
444448
NOTE: This field is specific to enterprise clusters.
445449
:type update_strategy: str
450+
:param disk_encryption: Local disk encryption setting for this LKE node pool.
451+
One of 'enabled' or 'disabled'. Defaults to 'disabled'.
452+
:type disk_encryption: str or InstanceDiskEncryptionType
446453
:param kwargs: Any other arguments to pass to the API. See the API docs
447454
for possible values.
448455
@@ -459,6 +466,7 @@ def node_pool_create(
459466
"taints": taints,
460467
"k8s_version": k8s_version,
461468
"update_strategy": update_strategy,
469+
"disk_encryption": disk_encryption,
462470
}
463471
params.update(kwargs)
464472

test/integration/models/lke/test_lke.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,21 @@ def _to_comparable(p: LKENodePool) -> Dict[str, Any]:
211211
)
212212

213213

214+
def test_node_pool_create_with_disk_encryption(test_linode_client, lke_cluster):
215+
node_type = test_linode_client.linode.types()[1]
216+
217+
pool = lke_cluster.node_pool_create(
218+
node_type,
219+
1,
220+
disk_encryption=InstanceDiskEncryptionType.enabled,
221+
)
222+
223+
try:
224+
assert pool.disk_encryption == InstanceDiskEncryptionType.enabled
225+
finally:
226+
pool.delete()
227+
228+
214229
def test_cluster_dashboard_url_view(lke_cluster):
215230
cluster = lke_cluster
216231

0 commit comments

Comments
 (0)