Skip to content

Commit

Permalink
validate instance types
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerosenthal committed Sep 19, 2024
1 parent aef0280 commit 1474aa9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/_nebari/stages/infrastructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,21 @@ def _check_input(cls, data: Any) -> Any:
raise ValueError(
f"\nInvalid `kubernetes-version` provided: {data['kubernetes_version']}.\nPlease select from one of the following supported Kubernetes versions: {available_kubernetes_versions} or omit flag to use latest Kubernetes version available."
)

# check if instances are valid
available_instances = google_cloud.instances(data["region"])
if "node_groups" in data:
for _, node_group in data["node_groups"].items():
instance = (
node_group["instance"]
if hasattr(node_group, "__getitem__")
else node_group.instance
)
if instance not in available_instances:
raise ValueError(
f"Google Cloud Platform instance {node_group.instance} not one of available instance types={available_instances}"
)

return data


Expand Down

0 comments on commit 1474aa9

Please sign in to comment.