Skip to content

feat(k8s): add MigrateClusterToRoutedIPs #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2024
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
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/k8s/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
from .types import ListPoolsResponse
from .types import ListVersionsRequest
from .types import ListVersionsResponse
from .types import MigrateClusterToRoutedIPsRequest
from .types import MigrateToPrivateNetworkClusterRequest
from .types import RebootNodeRequest
from .types import ReplaceNodeRequest
Expand Down Expand Up @@ -140,6 +141,7 @@
"ListPoolsResponse",
"ListVersionsRequest",
"ListVersionsResponse",
"MigrateClusterToRoutedIPsRequest",
"MigrateToPrivateNetworkClusterRequest",
"RebootNodeRequest",
"ReplaceNodeRequest",
Expand Down
35 changes: 35 additions & 0 deletions scaleway-async/scaleway_async/k8s/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,41 @@ async def migrate_to_private_network_cluster(
self._throw_on_error(res)
return unmarshal_Cluster(res.json())

async def migrate_cluster_to_routed_i_ps(
self,
*,
cluster_id: str,
region: Optional[Region] = None,
) -> Cluster:
"""
Migrate a cluster to Routed IPs.
Migrate the nodes of an existing cluster to Routed IPs and enable Routed IPs for all future nodes.
:param cluster_id:
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`Cluster <Cluster>`

Usage:
::

result = await api.migrate_cluster_to_routed_i_ps(
cluster_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_cluster_id = validate_path_param("cluster_id", cluster_id)

res = self._request(
"POST",
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-routed-ips",
body={},
)

self._throw_on_error(res)
return unmarshal_Cluster(res.json())

async def list_pools(
self,
*,
Expand Down
4 changes: 0 additions & 4 deletions scaleway-async/scaleway_async/k8s/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,6 @@ def unmarshal_Cluster(data: Any) -> Cluster:
else:
args["routed_ip_enabled"] = None

field = data.get("routed_ip_enabled", None)
if field is not None:
args["routed_ip_enabled"] = field

return Cluster(**args)


Expand Down
10 changes: 10 additions & 0 deletions scaleway-async/scaleway_async/k8s/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,16 @@ class ListVersionsResponse:
"""


@dataclass
class MigrateClusterToRoutedIPsRequest:
cluster_id: str

region: Optional[Region]
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class MigrateToPrivateNetworkClusterRequest:
cluster_id: str
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/k8s/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
from .types import ListPoolsResponse
from .types import ListVersionsRequest
from .types import ListVersionsResponse
from .types import MigrateClusterToRoutedIPsRequest
from .types import MigrateToPrivateNetworkClusterRequest
from .types import RebootNodeRequest
from .types import ReplaceNodeRequest
Expand Down Expand Up @@ -140,6 +141,7 @@
"ListPoolsResponse",
"ListVersionsRequest",
"ListVersionsResponse",
"MigrateClusterToRoutedIPsRequest",
"MigrateToPrivateNetworkClusterRequest",
"RebootNodeRequest",
"ReplaceNodeRequest",
Expand Down
35 changes: 35 additions & 0 deletions scaleway/scaleway/k8s/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,41 @@ def migrate_to_private_network_cluster(
self._throw_on_error(res)
return unmarshal_Cluster(res.json())

def migrate_cluster_to_routed_i_ps(
self,
*,
cluster_id: str,
region: Optional[Region] = None,
) -> Cluster:
"""
Migrate a cluster to Routed IPs.
Migrate the nodes of an existing cluster to Routed IPs and enable Routed IPs for all future nodes.
:param cluster_id:
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`Cluster <Cluster>`

Usage:
::

result = api.migrate_cluster_to_routed_i_ps(
cluster_id="example",
)
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)
param_cluster_id = validate_path_param("cluster_id", cluster_id)

res = self._request(
"POST",
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-to-routed-ips",
body={},
)

self._throw_on_error(res)
return unmarshal_Cluster(res.json())

def list_pools(
self,
*,
Expand Down
4 changes: 0 additions & 4 deletions scaleway/scaleway/k8s/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,6 @@ def unmarshal_Cluster(data: Any) -> Cluster:
else:
args["routed_ip_enabled"] = None

field = data.get("routed_ip_enabled", None)
if field is not None:
args["routed_ip_enabled"] = field

return Cluster(**args)


Expand Down
10 changes: 10 additions & 0 deletions scaleway/scaleway/k8s/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,16 @@ class ListVersionsResponse:
"""


@dataclass
class MigrateClusterToRoutedIPsRequest:
cluster_id: str

region: Optional[Region]
"""
Region to target. If none is passed will use default region from the config.
"""


@dataclass
class MigrateToPrivateNetworkClusterRequest:
cluster_id: str
Expand Down