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

Enable spot instances #11

Merged
merged 8 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 5 additions & 0 deletions terraform/aws/buckets.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
resource "aws_s3_bucket" "flink_store" {
bucket = "${var.cluster_name}-flink-store"
force_destroy = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally suggest leaving this out, and hand-editing it in when you want to acutally destroy it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this bucket for now as the cluster seemed unable to write to it. Eventually, we'll want to add a shared filesystem to the cluster where flink can cache metadata for restarting failed jobs. https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/ha/kubernetes_ha/

}

resource "aws_s3_bucket" "buckets" {
for_each = toset(var.buckets)
bucket = each.key
Expand Down
4 changes: 3 additions & 1 deletion terraform/aws/nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ resource "aws_eks_node_group" "core_nodes" {

instance_types = [var.instance_type]

capacity_type = "SPOT"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this should be in fact using the variable var.capacity_type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Fixed.


scaling_config {
desired_size = 1
max_size = var.max_instances
Expand All @@ -59,4 +61,4 @@ resource "aws_eks_node_group" "core_nodes" {
aws_iam_role_policy_attachment.node_worker_cni_policy_attachment,
aws_iam_role_policy_attachment.node_worker_ecr_policy_attachment
]
}
}
13 changes: 13 additions & 0 deletions terraform/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ variable "instance_type" {
EOT
}

variable "capacity_type" {
default = "ON_DEMAND"
description = <<-EOT
Whether to use ON_DEMAND or SPOT instances.
EOT

validation {
condition = contains(["ON_DEMAND", "SPOT"], var.capacity_type)
error_message = "The capcity_type value must be ON_DEMAND or SPOT."
}
}

variable "max_instances" {
default = 10
type = number
Expand All @@ -27,6 +39,7 @@ variable "max_instances" {
EOT
}


variable "flink_operator_version" {
default = "1.5.0"
description = <<-EOT
Expand Down