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

feat: Adding support for AWS Batch #620

Merged
merged 6 commits into from
Sep 19, 2024

Conversation

delagoya
Copy link
Contributor

Adding support for AWS Batch, addresses issue #456

  • Add the AWS Batch blueprint under schedulers/terraform
  • Adds tutorial for running an example AWS Batch job in the created EKS cluster
  • Added AWS Batch to Job Schedulers index page.
  • Addresses issue Add support for AWS Batch #456

What does this PR do?

🛑 Please open an issue first to discuss any significant work and flesh out details/direction - we would hate for your time to be wasted.
Consult the CONTRIBUTING guide for submitting pull-requests.

Adds support for AWS Batch.

Motivation

AWS Batch supports running high performance, compute intensive, and batch workloads on EKS. This blueprint provides a template to stand up all required AWS resources and Kubernetes permissions to enable AWS Batch managed services to launch jobs as pods on an EKS cluster.

More

  • Yes, I have tested the PR using my local account setup (Provide any test evidence report under Additional Notes)
  • Mandatory for new blueprints. Yes, I have added a example to support my blueprint PR
  • Mandatory for new blueprints. Yes, I have updated the website/docs or website/blog section for this feature
  • Yes, I ran pre-commit run -a with this PR. Link for installing pre-commit locally

For Moderators

  • E2E Test successfully complete before merge?

Additional Notes

* Add the AWS Batch blueprint under `schedulers/terraform`
* Adds tutorial for running an example AWS Batch job in the created EKS cluster
* Added AWS Batch to Job Schedulers index page.
@delagoya delagoya changed the title Adding support for AWS Batch, addresses issue #456 feat: Adding support for AWS Batch Aug 26, 2024
Copy link
Collaborator

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @delagoya ! I did first round of review and left some comments.

schedulers/terraform/aws-batch-eks/data-providers.tf Outdated Show resolved Hide resolved
schedulers/terraform/aws-batch-eks/eks.tf Outdated Show resolved Hide resolved
schedulers/terraform/aws-batch-eks/eks.tf Outdated Show resolved Hide resolved
Comment on lines 219 to 249
module "eks_auth" {
source = "terraform-aws-modules/eks/aws//modules/aws-auth"
version = "~> 20.0"

manage_aws_auth_configmap = true
aws_auth_roles = [
{
rolearn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/AWSServiceRoleForBatch"
username = "aws-batch"
groups = []
},
{
rolearn = module.eks.eks_managed_node_groups["default"].iam_role_arn
username = "system:node:{{EC2PrivateDNSName}}"
groups = ["system:bootstrappers", "system:nodes"]
},
{
rolearn = aws_iam_role.batch_eks_instance_role.arn
username = "system:node:{{EC2PrivateDNSName}}"
groups = ["system:bootstrappers", "system:nodes"]
}
]
depends_on = [
module.eks,
kubernetes_namespace.doeks_batch_namespace,
kubernetes_cluster_role.batch_cluster_role,
kubernetes_cluster_role_binding.batch_cluster_role_binding,
kubernetes_role.batch_compute_env_role,
kubernetes_role_binding.batch_compute_env_role_binding
]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You dont need this. you can pass the additional auth roles through variables. Check the EKS TF module for input variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you point me at an example? I am not seeing the input for config maps from the EKS TF module. I only see how to do this via the aws-auth submodule which I am using in the above code.

schedulers/terraform/aws-batch-eks/locals.tf Outdated Show resolved Hide resolved
schedulers/terraform/aws-batch-eks/outputs.tf Outdated Show resolved Hide resolved
schedulers/terraform/aws-batch-eks/provider.tf Outdated Show resolved Hide resolved
schedulers/terraform/aws-batch-eks/variables.tf Outdated Show resolved Hide resolved
Comment on lines +34 to +64
variable "vpc_cidr" {
description = "VPC CIDR"
type = string
default = "10.1.0.0/16"
}

# Only two Subnets for with low IP range for internet access
variable "public_subnets" {
description = "Public Subnets CIDRs. 62 IPs per Subnet"
type = list(string)
default = ["10.1.255.128/26", "10.1.255.192/26"]
}

variable "private_subnets" {
description = "Private Subnets CIDRs. 32766 Subnet1 and 16382 Subnet2 IPs per Subnet"
type = list(string)
default = ["10.1.0.0/17", "10.1.128.0/18"]
}

variable "eks_public_cluster_endpoint" {
description = "Whether to have a public cluster endpoint for the EKS cluster. #WARNING: Avoid a public endpoint in preprod or prod accounts. This feature is designed for sandbox accounts, simplifying cluster deployment and testing."
type = bool
default = true
}

variable "eks_private_cluster_endpoint" {
description = "Whether to have a private cluster endpoint for the EKS cluster."
type = bool
default = true
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which part are you referring to? The private vs public endpoint? The CIDR specifications?

@delagoya
Copy link
Contributor Author

Any update on review?

Copy link
Collaborator

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

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

/lgtm

@vara-bonthu vara-bonthu merged commit e55bc38 into awslabs:main Sep 19, 2024
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants