Skip to content
Open
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
21 changes: 13 additions & 8 deletions Azimuth/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,23 @@ def find_cluster_by_name(self, name: str) -> dict[str, t.Any]:

@keyword
def create_cluster(
self, name: str, cluster_type: str, **parameter_values: t.Any
self,
name: str,
cluster_type: str,
schedule: dict[str, t.Any] | None = None,
**parameter_values: t.Any,
) -> dict[str, t.Any]:
"""
Creates a cluster using the active client.
"""
return self._resource.create(
{
"name": name,
"cluster_type": cluster_type,
"parameter_values": parameter_values,
}
)
payload = {
"name": name,
"cluster_type": cluster_type,
"parameter_values": parameter_values,
}
if schedule is not None:
payload["schedule"] = schedule
return self._resource.create(payload)

@keyword
def patch_cluster(self, id: str) -> dict[str, t.Any]: # noqa: A002
Expand Down
10 changes: 10 additions & 0 deletions Azimuth/kubernetes_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class KubernetesClusterConfig:
ingress_enabled: bool = False
ingress_controller_load_balancer_ip: str | None = None
monitoring_enabled: bool = False
schedule: dict[str, t.Any] | None = None


@enum.unique
Expand Down Expand Up @@ -225,6 +226,15 @@ def disable_monitoring_for_kubernetes_config(
"""
return dataclasses.replace(config, monitoring_enabled=False)

@keyword
def enable_scheduling_for_kubernetes_config(
self, config: KubernetesClusterConfig, end_time: str
) -> KubernetesClusterConfig:
"""
Enables platform scheduling for the current Kubernetes config.
"""
return dataclasses.replace(config, schedule={"end_time": end_time})

@keyword
def create_kubernetes_cluster(
self, config: KubernetesClusterConfig
Expand Down