Skip to content

Commit 0199b8c

Browse files
feat(api): aggregated API specs update
1 parent 92ed2a3 commit 0199b8c

File tree

8 files changed

+183
-7
lines changed

8 files changed

+183
-7
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 524
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml
3-
openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-71ebc8da15fdc297934029972bf2536f4abc6a167b38df66cf8c3f5a0d69bf4a.yml
3+
openapi_spec_hash: ac7c9a26fa95888ecb41f32b35f9a7ec
44
config_hash: fee4391924d7ea28b2bb5e5d81c8778f

src/gcore/resources/cloud/k8s/clusters/clusters.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def create(
8686
name: str,
8787
pools: Iterable[cluster_create_params.Pool],
8888
version: str,
89+
add_ons: cluster_create_params.AddOns | Omit = omit,
8990
authentication: Optional[cluster_create_params.Authentication] | Omit = omit,
9091
autoscaler_config: Optional[Dict[str, str]] | Omit = omit,
9192
cni: Optional[cluster_create_params.Cni] | Omit = omit,
@@ -118,6 +119,8 @@ def create(
118119
119120
version: The version of the k8s cluster
120121
122+
add_ons: Cluster add-ons configuration
123+
121124
authentication: Authentication settings
122125
123126
autoscaler_config: Cluster autoscaler configuration.
@@ -220,6 +223,7 @@ def create(
220223
"name": name,
221224
"pools": pools,
222225
"version": version,
226+
"add_ons": add_ons,
223227
"authentication": authentication,
224228
"autoscaler_config": autoscaler_config,
225229
"cni": cni,
@@ -248,6 +252,7 @@ def update(
248252
*,
249253
project_id: int | None = None,
250254
region_id: int | None = None,
255+
add_ons: cluster_update_params.AddOns | Omit = omit,
251256
authentication: Optional[cluster_update_params.Authentication] | Omit = omit,
252257
autoscaler_config: Optional[Dict[str, str]] | Omit = omit,
253258
cni: Optional[cluster_update_params.Cni] | Omit = omit,
@@ -264,6 +269,8 @@ def update(
264269
Update k8s cluster
265270
266271
Args:
272+
add_ons: Cluster add-ons configuration
273+
267274
authentication: Authentication settings
268275
269276
autoscaler_config: Cluster autoscaler configuration.
@@ -348,6 +355,7 @@ def update(
348355
f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}",
349356
body=maybe_transform(
350357
{
358+
"add_ons": add_ons,
351359
"authentication": authentication,
352360
"autoscaler_config": autoscaler_config,
353361
"cni": cni,
@@ -681,6 +689,7 @@ async def create(
681689
name: str,
682690
pools: Iterable[cluster_create_params.Pool],
683691
version: str,
692+
add_ons: cluster_create_params.AddOns | Omit = omit,
684693
authentication: Optional[cluster_create_params.Authentication] | Omit = omit,
685694
autoscaler_config: Optional[Dict[str, str]] | Omit = omit,
686695
cni: Optional[cluster_create_params.Cni] | Omit = omit,
@@ -713,6 +722,8 @@ async def create(
713722
714723
version: The version of the k8s cluster
715724
725+
add_ons: Cluster add-ons configuration
726+
716727
authentication: Authentication settings
717728
718729
autoscaler_config: Cluster autoscaler configuration.
@@ -815,6 +826,7 @@ async def create(
815826
"name": name,
816827
"pools": pools,
817828
"version": version,
829+
"add_ons": add_ons,
818830
"authentication": authentication,
819831
"autoscaler_config": autoscaler_config,
820832
"cni": cni,
@@ -843,6 +855,7 @@ async def update(
843855
*,
844856
project_id: int | None = None,
845857
region_id: int | None = None,
858+
add_ons: cluster_update_params.AddOns | Omit = omit,
846859
authentication: Optional[cluster_update_params.Authentication] | Omit = omit,
847860
autoscaler_config: Optional[Dict[str, str]] | Omit = omit,
848861
cni: Optional[cluster_update_params.Cni] | Omit = omit,
@@ -859,6 +872,8 @@ async def update(
859872
Update k8s cluster
860873
861874
Args:
875+
add_ons: Cluster add-ons configuration
876+
862877
authentication: Authentication settings
863878
864879
autoscaler_config: Cluster autoscaler configuration.
@@ -943,6 +958,7 @@ async def update(
943958
f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}",
944959
body=await async_maybe_transform(
945960
{
961+
"add_ons": add_ons,
946962
"authentication": authentication,
947963
"autoscaler_config": autoscaler_config,
948964
"cni": cni,

src/gcore/resources/cloud/k8s/clusters/pools/pools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def update(
187187
188188
min_node_count: Minimum node count
189189
190-
node_count: Current node count
190+
node_count: This field is deprecated. Please use the cluster pool resize handler instead.
191191
192192
taints: Taints applied to the cluster pool
193193
@@ -549,7 +549,7 @@ async def update(
549549
550550
min_node_count: Minimum node count
551551
552-
node_count: Current node count
552+
node_count: This field is deprecated. Please use the cluster pool resize handler instead.
553553
554554
taints: Taints applied to the cluster pool
555555

src/gcore/types/cloud/k8s/cluster_create_params.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
from typing import Dict, List, Iterable, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

8+
from ...._types import SequenceNotStr
89
from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam
910

1011
__all__ = [
1112
"ClusterCreateParams",
1213
"Pool",
14+
"AddOns",
15+
"AddOnsSlurm",
1316
"Authentication",
1417
"AuthenticationOidc",
1518
"Cni",
@@ -39,6 +42,9 @@ class ClusterCreateParams(TypedDict, total=False):
3942
version: Required[str]
4043
"""The version of the k8s cluster"""
4144

45+
add_ons: AddOns
46+
"""Cluster add-ons configuration"""
47+
4248
authentication: Optional[Authentication]
4349
"""Authentication settings"""
4450

@@ -177,6 +183,40 @@ class Pool(TypedDict, total=False):
177183
"""Taints applied to the cluster pool"""
178184

179185

186+
class AddOnsSlurm(TypedDict, total=False):
187+
enabled: Required[Literal[True]]
188+
"""The Slurm add-on will be enabled in the cluster.
189+
190+
This add-on is only supported in clusters running Kubernetes v1.31 and v1.32
191+
with at least 1 GPU cluster pool and VAST NFS support enabled.
192+
"""
193+
194+
file_share_id: Required[str]
195+
"""ID of a VAST file share to be used as Slurm storage.
196+
197+
The Slurm add-on will create separate Persistent Volume Claims for different
198+
purposes (controller spool, worker spool, jail) on that file share.
199+
200+
The file share must have `root_squash` disabled, while `path_length` and
201+
`allowed_characters` settings must be set to `NPL`.
202+
"""
203+
204+
ssh_key_ids: Required[SequenceNotStr[str]]
205+
"""IDs of SSH keys to authorize for SSH connection to Slurm login nodes."""
206+
207+
worker_count: Required[int]
208+
"""Size of the worker pool, i.e. the number of Slurm worker nodes.
209+
210+
Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU
211+
nodes.
212+
"""
213+
214+
215+
class AddOns(TypedDict, total=False):
216+
slurm: AddOnsSlurm
217+
"""Slurm add-on configuration"""
218+
219+
180220
class AuthenticationOidc(TypedDict, total=False):
181221
client_id: Optional[str]
182222
"""Client ID"""

src/gcore/types/cloud/k8s/cluster_update_params.py

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Iterable, Optional
6-
from typing_extensions import Literal, Required, TypedDict
5+
from typing import Dict, List, Union, Iterable, Optional
6+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

8+
from ...._types import SequenceNotStr
89
from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam
910

1011
__all__ = [
1112
"ClusterUpdateParams",
13+
"AddOns",
14+
"AddOnsSlurm",
15+
"AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer",
16+
"AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer",
1217
"Authentication",
1318
"AuthenticationOidc",
1419
"Cni",
@@ -24,6 +29,9 @@ class ClusterUpdateParams(TypedDict, total=False):
2429

2530
region_id: int
2631

32+
add_ons: AddOns
33+
"""Cluster add-ons configuration"""
34+
2735
authentication: Optional[Authentication]
2836
"""Authentication settings"""
2937

@@ -97,6 +105,50 @@ class ClusterUpdateParams(TypedDict, total=False):
97105
"""Logging configuration"""
98106

99107

108+
class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False):
109+
enabled: Required[Literal[True]]
110+
"""The Slurm add-on will be enabled in the cluster.
111+
112+
This add-on is only supported in clusters running Kubernetes v1.31 and v1.32
113+
with at least 1 GPU cluster pool and VAST NFS support enabled.
114+
"""
115+
116+
file_share_id: Required[str]
117+
"""ID of a VAST file share to be used as Slurm storage.
118+
119+
The Slurm add-on will create separate Persistent Volume Claims for different
120+
purposes (controller spool, worker spool, jail) on that file share.
121+
122+
The file share must have `root_squash` disabled, while `path_length` and
123+
`allowed_characters` settings must be set to `NPL`.
124+
"""
125+
126+
ssh_key_ids: Required[SequenceNotStr[str]]
127+
"""IDs of SSH keys to authorize for SSH connection to Slurm login nodes."""
128+
129+
worker_count: Required[int]
130+
"""Size of the worker pool, i.e. the number of Slurm worker nodes.
131+
132+
Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU
133+
nodes.
134+
"""
135+
136+
137+
class AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer(TypedDict, total=False):
138+
enabled: Required[bool]
139+
"""The Slurm add-on will be disabled in the cluster."""
140+
141+
142+
AddOnsSlurm: TypeAlias = Union[
143+
AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer, AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer
144+
]
145+
146+
147+
class AddOns(TypedDict, total=False):
148+
slurm: AddOnsSlurm
149+
"""Slurm add-on configuration"""
150+
151+
100152
class AuthenticationOidc(TypedDict, total=False):
101153
client_id: Optional[str]
102154
"""Client ID"""

src/gcore/types/cloud/k8s/clusters/pool_update_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PoolUpdateParams(TypedDict, total=False):
2828
"""Minimum node count"""
2929

3030
node_count: Optional[int]
31-
"""Current node count"""
31+
"""This field is deprecated. Please use the cluster pool resize handler instead."""
3232

3333
taints: Optional[Dict[str, str]]
3434
"""Taints applied to the cluster pool"""

src/gcore/types/cloud/k8s/k8s_cluster.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
__all__ = [
1212
"K8sCluster",
13+
"AddOns",
14+
"AddOnsSlurm",
1315
"Csi",
1416
"CsiNfs",
1517
"Authentication",
@@ -21,6 +23,37 @@
2123
]
2224

2325

26+
class AddOnsSlurm(BaseModel):
27+
enabled: bool
28+
"""Indicates whether Slurm add-on is deployed in the cluster.
29+
30+
This add-on is only supported in clusters running Kubernetes v1.31 and v1.32
31+
with at least 1 GPU cluster pool.
32+
"""
33+
34+
file_share_id: Optional[str] = None
35+
"""ID of a VAST file share used as Slurm storage.
36+
37+
The Slurm add-on creates separate Persistent Volume Claims for different
38+
purposes (controller spool, worker spool, jail) on that file share.
39+
"""
40+
41+
ssh_key_ids: Optional[List[str]] = None
42+
"""IDs of SSH keys authorized for SSH connection to Slurm login nodes."""
43+
44+
worker_count: Optional[int] = None
45+
"""Size of the worker pool, i.e. number of worker nodes.
46+
47+
Each Slurm worker node is backed by a Pod scheduled on one of cluster's GPU
48+
nodes.
49+
"""
50+
51+
52+
class AddOns(BaseModel):
53+
slurm: AddOnsSlurm
54+
"""Slurm add-on configuration"""
55+
56+
2457
class CsiNfs(BaseModel):
2558
vast_enabled: bool
2659
"""Indicates the status of VAST NFS integration"""
@@ -135,6 +168,9 @@ class K8sCluster(BaseModel):
135168
id: str
136169
"""Cluster pool uuid"""
137170

171+
add_ons: AddOns
172+
"""Cluster add-ons configuration"""
173+
138174
created_at: str
139175
"""Function creation date"""
140176

tests/api_resources/cloud/k8s/test_clusters.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
6666
}
6767
],
6868
version="1.28.1",
69+
add_ons={
70+
"slurm": {
71+
"enabled": True,
72+
"file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c",
73+
"ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"],
74+
"worker_count": 2,
75+
}
76+
},
6977
authentication={
7078
"oidc": {
7179
"client_id": "kubernetes",
@@ -183,6 +191,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
183191
cluster_name="cluster_name",
184192
project_id=0,
185193
region_id=0,
194+
add_ons={
195+
"slurm": {
196+
"enabled": True,
197+
"file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c",
198+
"ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"],
199+
"worker_count": 2,
200+
}
201+
},
186202
authentication={
187203
"oidc": {
188204
"client_id": "kubernetes",
@@ -641,6 +657,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
641657
}
642658
],
643659
version="1.28.1",
660+
add_ons={
661+
"slurm": {
662+
"enabled": True,
663+
"file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c",
664+
"ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"],
665+
"worker_count": 2,
666+
}
667+
},
644668
authentication={
645669
"oidc": {
646670
"client_id": "kubernetes",
@@ -758,6 +782,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
758782
cluster_name="cluster_name",
759783
project_id=0,
760784
region_id=0,
785+
add_ons={
786+
"slurm": {
787+
"enabled": True,
788+
"file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c",
789+
"ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"],
790+
"worker_count": 2,
791+
}
792+
},
761793
authentication={
762794
"oidc": {
763795
"client_id": "kubernetes",

0 commit comments

Comments
 (0)