Skip to content

Commit c04e775

Browse files
committed
Merge branch 'main' into fix/unauthorized-kms
* main: fix: remove old variables from node groups fix: revert instance type fix: test utils code ref: following suggestion in issue 3068 fix: run precommit REF: update based on code review fix: revert qhub changes Include functionality for spot instances on AWS
2 parents 9d7ea0d + 06f527d commit c04e775

File tree

5 files changed

+7
-1
lines changed

5 files changed

+7
-1
lines changed

src/_nebari/stages/infrastructure/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class AWSNodeGroupInputVars(schema.Base):
188188
max_size: int
189189
single_subnet: bool
190190
permissions_boundary: Optional[str] = None
191+
spot: bool = False
191192
ami_type: Optional[AWSAmiTypes] = None
192193
launch_template: Optional[AWSNodeLaunchTemplate] = None
193194
node_taints: list[dict]
@@ -521,6 +522,7 @@ class AWSNodeGroup(NodeGroup):
521522
gpu: bool = False
522523
single_subnet: bool = False
523524
permissions_boundary: Optional[str] = None
525+
spot: bool = False
524526
# Disabled as part of 2024.11.1 until #2832 is resolved
525527
# launch_template: Optional[AWSNodeLaunchTemplate] = None
526528

@@ -959,6 +961,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
959961
gpu_enabled=node_group.gpu,
960962
launch_template=None,
961963
),
964+
spot=node_group.spot,
962965
)
963966
for name, node_group in self.config.amazon_web_services.node_groups.items()
964967
],

src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ resource "aws_eks_node_group" "main" {
9292
subnet_ids = var.node_groups[count.index].single_subnet ? [element(var.cluster_subnets, 0)] : var.cluster_subnets
9393

9494
instance_types = [var.node_groups[count.index].instance_type]
95+
capacity_type = var.node_groups[count.index].spot ? "SPOT" : "ON_DEMAND"
9596
ami_type = var.node_groups[count.index].ami_type
9697
disk_size = var.node_groups[count.index].launch_template == null ? 50 : null
9798

src/_nebari/stages/infrastructure/template/aws/modules/kubernetes/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ variable "node_groups" {
4646
type = list(object({
4747
name = string
4848
instance_type = string
49+
spot = bool
4950
gpu = bool
5051
min_size = number
5152
desired_size = number

src/_nebari/stages/infrastructure/template/aws/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ variable "node_groups" {
3333
type = list(object({
3434
name = string
3535
instance_type = string
36+
spot = bool
3637
gpu = bool
3738
min_size = number
3839
desired_size = number

tests/common/config_mod_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ def add_preemptible_node_group(config, cloud="aws"):
130130
node_group = None
131131
if cloud == "aws":
132132
cloud_name = "amazon_web_services"
133-
# TODO: how to make preemptible?
134133
node_group = AWSNodeGroup(
135134
instance="m5.xlarge",
136135
min_nodes=1,
137136
max_nodes=5,
138137
single_subnet=False,
139138
taints=DEFAULT_NODE_GROUP_TAINTS,
139+
spot=True,
140140
)
141141
elif cloud == "gcp":
142142
cloud_name = "google_cloud_platform"

0 commit comments

Comments
 (0)