Skip to content
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

Add option for AWS node-groups to run in a single subnet/AZ #1428

Merged
merged 9 commits into from
Jan 27, 2023
14 changes: 12 additions & 2 deletions nebari/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,18 @@ def __getattr__(name):
"kubernetes_version": "PLACEHOLDER",
"node_groups": {
"general": {"instance": "m5.2xlarge", "min_nodes": 1, "max_nodes": 1},
"user": {"instance": "m5.xlarge", "min_nodes": 1, "max_nodes": 5},
"worker": {"instance": "m5.xlarge", "min_nodes": 1, "max_nodes": 5},
"user": {
"instance": "m5.xlarge",
"min_nodes": 1,
"max_nodes": 5,
"single_subnet": True,
},
"worker": {
"instance": "m5.xlarge",
"min_nodes": 1,
"max_nodes": 5,
"single_subnet": True,
},
},
}

Expand Down
6 changes: 5 additions & 1 deletion nebari/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ def validate_guest_accelerators(cls, v):
raise ValueError(assertion_error_message)


class AWSNodeGroup(NodeGroup):
single_subnet: typing.Optional[bool] = False


class DigitalOceanProvider(Base):
region: str
kubernetes_version: str
Expand Down Expand Up @@ -320,7 +324,7 @@ class AmazonWebServicesProvider(Base):
region: str
availability_zones: typing.Optional[typing.List[str]]
kubernetes_version: str
node_groups: typing.Dict[str, NodeGroup]
node_groups: typing.Dict[str, AWSNodeGroup]
terraform_overrides: typing.Any


Expand Down
1 change: 1 addition & 0 deletions nebari/stages/input_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def stage_02_infrastructure(stage_outputs, config):
"max_size": value["max_nodes"],
"gpu": value.get("gpu", False),
"instance_type": value["instance"],
"single_subnet": value.get("single_subnet", False),
}
for key, value in config["amazon_web_services"]["node_groups"].items()
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "aws_eks_node_group" "main" {
cluster_name = aws_eks_cluster.main.name
node_group_name = var.node_groups[count.index].name
node_role_arn = aws_iam_role.node-group.arn
subnet_ids = var.cluster_subnets
subnet_ids = var.node_groups[count.index].single_subnet ? [element(var.cluster_subnets, 0)] : var.cluster_subnets

instance_types = [var.node_groups[count.index].instance_type]
ami_type = var.node_groups[count.index].gpu == true ? "AL2_x86_64_GPU" : "AL2_x86_64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ variable "node_groups" {
min_size = number
desired_size = number
max_size = number
single_subnet = bool
}))
}

Expand Down
1 change: 1 addition & 0 deletions nebari/template/stages/02-infrastructure/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ variable "node_groups" {
min_size = number
desired_size = number
max_size = number
single_subnet = bool
}))
}

Expand Down