Skip to content

Commit f26d3ac

Browse files
authored
feat(k8s): enable passing a security group ID at pool creation (#1014)
1 parent ba08c7a commit f26d3ac

File tree

6 files changed

+56
-0
lines changed

6 files changed

+56
-0
lines changed

scaleway-async/scaleway_async/k8s/v1/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ async def create_pool(
10441044
zone: Optional[ScwZone] = None,
10451045
root_volume_type: Optional[PoolVolumeType] = None,
10461046
root_volume_size: Optional[int] = None,
1047+
security_group_id: Optional[str] = None,
10471048
) -> Pool:
10481049
"""
10491050
Create a new Pool in a Cluster.
@@ -1069,6 +1070,7 @@ async def create_pool(
10691070
* `sbs-15k` is a faster remote block storage which means your system is stored on a centralized and resilient cluster with 15k IOPS limits
10701071
* `b_ssd` is the legacy remote block storage which means your system is stored on a centralized and resilient cluster. Consider using `sbs-5k` or `sbs-15k` instead.
10711072
:param root_volume_size: System volume disk size.
1073+
:param security_group_id: Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
10721074
:return: :class:`Pool <Pool>`
10731075
10741076
Usage:
@@ -1112,6 +1114,7 @@ async def create_pool(
11121114
zone=zone,
11131115
root_volume_type=root_volume_type,
11141116
root_volume_size=root_volume_size,
1117+
security_group_id=security_group_id,
11151118
),
11161119
self.client,
11171120
),

scaleway-async/scaleway_async/k8s/v1/marshalling.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def unmarshal_Pool(data: Any) -> Pool:
169169
if field is not None:
170170
args["public_ip_disabled"] = field
171171

172+
field = data.get("security_group_id", None)
173+
if field is not None:
174+
args["security_group_id"] = field
175+
172176
field = data.get("region", None)
173177
if field is not None:
174178
args["region"] = field
@@ -1282,6 +1286,9 @@ def marshal_CreateClusterRequestPoolConfig(
12821286
if request.root_volume_size is not None:
12831287
output["root_volume_size"] = request.root_volume_size
12841288

1289+
if request.security_group_id is not None:
1290+
output["security_group_id"] = request.security_group_id
1291+
12851292
return output
12861293

12871294

@@ -1434,6 +1441,9 @@ def marshal_CreatePoolRequest(
14341441
if request.root_volume_size is not None:
14351442
output["root_volume_size"] = request.root_volume_size
14361443

1444+
if request.security_group_id is not None:
1445+
output["security_group_id"] = request.security_group_id
1446+
14371447
return output
14381448

14391449

scaleway-async/scaleway_async/k8s/v1/types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ class Pool:
433433
Defines if the public IP should be removed from Nodes. To use this feature, your Cluster must have an attached Private Network set up with a Public Gateway.
434434
"""
435435

436+
security_group_id: str
437+
"""
438+
Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
439+
"""
440+
436441
region: ScwRegion
437442
"""
438443
Cluster region of the pool.
@@ -677,6 +682,11 @@ class CreateClusterRequestPoolConfig:
677682
System volume disk size.
678683
"""
679684

685+
security_group_id: Optional[str]
686+
"""
687+
Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
688+
"""
689+
680690

681691
@dataclass
682692
class CreatePoolRequestUpgradePolicy:
@@ -1342,6 +1352,11 @@ class CreatePoolRequest:
13421352
System volume disk size.
13431353
"""
13441354

1355+
security_group_id: Optional[str]
1356+
"""
1357+
Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
1358+
"""
1359+
13451360

13461361
@dataclass
13471362
class DeleteACLRuleRequest:

scaleway/scaleway/k8s/v1/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ def create_pool(
10441044
zone: Optional[ScwZone] = None,
10451045
root_volume_type: Optional[PoolVolumeType] = None,
10461046
root_volume_size: Optional[int] = None,
1047+
security_group_id: Optional[str] = None,
10471048
) -> Pool:
10481049
"""
10491050
Create a new Pool in a Cluster.
@@ -1069,6 +1070,7 @@ def create_pool(
10691070
* `sbs-15k` is a faster remote block storage which means your system is stored on a centralized and resilient cluster with 15k IOPS limits
10701071
* `b_ssd` is the legacy remote block storage which means your system is stored on a centralized and resilient cluster. Consider using `sbs-5k` or `sbs-15k` instead.
10711072
:param root_volume_size: System volume disk size.
1073+
:param security_group_id: Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
10721074
:return: :class:`Pool <Pool>`
10731075
10741076
Usage:
@@ -1112,6 +1114,7 @@ def create_pool(
11121114
zone=zone,
11131115
root_volume_type=root_volume_type,
11141116
root_volume_size=root_volume_size,
1117+
security_group_id=security_group_id,
11151118
),
11161119
self.client,
11171120
),

scaleway/scaleway/k8s/v1/marshalling.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ def unmarshal_Pool(data: Any) -> Pool:
169169
if field is not None:
170170
args["public_ip_disabled"] = field
171171

172+
field = data.get("security_group_id", None)
173+
if field is not None:
174+
args["security_group_id"] = field
175+
172176
field = data.get("region", None)
173177
if field is not None:
174178
args["region"] = field
@@ -1282,6 +1286,9 @@ def marshal_CreateClusterRequestPoolConfig(
12821286
if request.root_volume_size is not None:
12831287
output["root_volume_size"] = request.root_volume_size
12841288

1289+
if request.security_group_id is not None:
1290+
output["security_group_id"] = request.security_group_id
1291+
12851292
return output
12861293

12871294

@@ -1434,6 +1441,9 @@ def marshal_CreatePoolRequest(
14341441
if request.root_volume_size is not None:
14351442
output["root_volume_size"] = request.root_volume_size
14361443

1444+
if request.security_group_id is not None:
1445+
output["security_group_id"] = request.security_group_id
1446+
14371447
return output
14381448

14391449

scaleway/scaleway/k8s/v1/types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ class Pool:
433433
Defines if the public IP should be removed from Nodes. To use this feature, your Cluster must have an attached Private Network set up with a Public Gateway.
434434
"""
435435

436+
security_group_id: str
437+
"""
438+
Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
439+
"""
440+
436441
region: ScwRegion
437442
"""
438443
Cluster region of the pool.
@@ -677,6 +682,11 @@ class CreateClusterRequestPoolConfig:
677682
System volume disk size.
678683
"""
679684

685+
security_group_id: Optional[str]
686+
"""
687+
Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
688+
"""
689+
680690

681691
@dataclass
682692
class CreatePoolRequestUpgradePolicy:
@@ -1342,6 +1352,11 @@ class CreatePoolRequest:
13421352
System volume disk size.
13431353
"""
13441354

1355+
security_group_id: Optional[str]
1356+
"""
1357+
Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone.
1358+
"""
1359+
13451360

13461361
@dataclass
13471362
class DeleteACLRuleRequest:

0 commit comments

Comments
 (0)