Skip to content

Commit 90a23d0

Browse files
authored
(Ocean/GKE) - Add initial_nodes option to GKE (#178)
1 parent b472e46 commit 90a23d0

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [3.10.0] - 2024-07-04
6+
### Added
7+
- Added `initialNodes` query parameter for Ocean GKE `create_virtual_node_group` API.
8+
59
## [3.9.1] - 2024-06-28
610
### Fixed
711
- Made few parameter objects in `create_right_sizing_rule` to optional (For internal use only).

docs/clients/ocean/ocean_gcp_client.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,16 @@ __Returns__
202202
<h2 id="spotinst_sdk2.clients.ocean.OceanGcpClient.create_virtual_node_group">create_virtual_node_group</h2>
203203

204204
```python
205-
OceanGcpClient.create_virtual_node_group(vng: VirtualNodeGroup)
205+
OceanGcpClient.create_virtual_node_group(vng: VirtualNodeGroup,
206+
initial_nodes: int = None)
206207
```
207208

208209
Create a virtual node group.
209210

210211
__Arguments__
211212

212213
- __vng (VirtualNodeGroup)__: VirtualNodeGroup Object
214+
- __initial_nodes__: When set to an integer greater than 0, a corresponding number of nodes will be launched from the virtual node group created.
213215

214216
__Returns__
215217

spotinst_sdk2/clients/ocean/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,8 @@ def get_aggregated_summary_costs(self, ocean_id: str, aggregated_cluster_costs:
18201820
# endregion
18211821

18221822
# region GCP
1823+
1824+
18231825
class OceanGcpClient(Client):
18241826
__base_ocean_url = "/ocean/k8s/cluster/"
18251827
__base_ocean_cluster_url = "/ocean/gcp/k8s/cluster"
@@ -2108,12 +2110,13 @@ def get_aggregated_summary_costs(self, ocean_id: str, aggregated_cluster_costs:
21082110

21092111
return formatted_response["response"]["items"][0]
21102112

2111-
def create_virtual_node_group(self, vng: gcp_ocean.VirtualNodeGroup):
2113+
def create_virtual_node_group(self, vng: gcp_ocean.VirtualNodeGroup, initial_nodes: int = None):
21122114
"""
21132115
Create a virtual node group.
21142116
21152117
# Arguments
21162118
vng (VirtualNodeGroup): VirtualNodeGroup Object
2119+
initial_nodes: When set to an integer greater than 0, a corresponding number of nodes will be launched from the virtual node group created.
21172120
21182121
# Returns
21192122
(Object): Ocean Launch Spec response
@@ -2128,10 +2131,13 @@ def create_virtual_node_group(self, vng: gcp_ocean.VirtualNodeGroup):
21282131

21292132
body_json = json.dumps(formatted_missing_dict)
21302133

2131-
response = self.send_post(
2134+
query_params = dict(initialNodes=initial_nodes)
2135+
2136+
response = self.send_post_with_params(
21322137
body=body_json,
21332138
url=self.__base_ocean_launchspec_url,
2134-
entity_name='ocean_gcp_vng')
2139+
entity_name='ocean_gcp_vng',
2140+
user_query_params=query_params)
21352141

21362142
formatted_response = self.convert_json(response,
21372143
self.camel_to_underscore)
@@ -2480,6 +2486,8 @@ def launch_nodes_in_vng(self, ocean_launch_spec_id: str, amount: int):
24802486
# endRegion
24812487

24822488
# region RightSizing
2489+
2490+
24832491
class OceanRightSizingClient(Client):
24842492

24852493
def create_right_sizing_rule(self, ocean_id: str, rule_name: str, restart_pods: bool,

spotinst_sdk2/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.9.1'
1+
__version__ = '3.10.0'

0 commit comments

Comments
 (0)