Skip to content

Commit

Permalink
🐛 fix(cleanup): remove unused code and add node group label (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Oct 16, 2024
1 parent b50a279 commit 9c78898
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 31 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tfmod-eks
Create an EKS cluster given the specification of the cluster.

The module creates an EKS cluster named cluster_name in the region using kuberenetes version cluster_version with eks_ng_desired_size nodes initially. The services in the cluster will be accessible using hostnames for the services ending with the cluster_name.domain fully qualified domain name. The cluster-autoscaler will resize the node group based upon capacity from a minimum of eks_ng_min_size to a maximum of eks_ng_max_size. The eks_instance_types is a prioritized list of instance types to use as the worker nodes. Note that it is best if the vCPU and Mem sizes of all of the instance types are the same.
The module creates an EKS cluster named `cluster_name` in the region using kubernetes version `cluster_version` with `eks_ng_desired_size` nodes initially. The services in the cluster will be accessible using hostnames for the services ending with the `cluster_name.domain` fully qualified domain name. The nodegroup for karpenter will resize based upon capacity from a minimum of `eks_ng_min_size` to a maximum of `eks_ng_max_size`. After initial deployment, karpenter will create a node group for workloads that will autoscale using on-demand or spot instances with compaction based upon running workloads.

The cluster is configured with an oidc provider allowing service accounts to be configured with IRSA roles as needed.

Expand Down Expand Up @@ -85,15 +85,15 @@ Change logs are auto-generated with commitizen.

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.67.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.70.0 |
| <a name="provider_null"></a> [null](#provider\_null) | 3.2.3 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_cloudwatch_observability_irsa_role"></a> [cloudwatch\_observability\_irsa\_role](#module\_cloudwatch\_observability\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | n/a |
| <a name="module_cluster"></a> [cluster](#module\_cluster) | git@github.e.it.census.gov:SCT-Engineering/terraform-aws-eks.git | v20.24.1 |
| <a name="module_cluster"></a> [cluster](#module\_cluster) | git@github.e.it.census.gov:SCT-Engineering/terraform-aws-eks.git | v20.24.3 |
| <a name="module_ebs_csi_irsa_role"></a> [ebs\_csi\_irsa\_role](#module\_ebs\_csi\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | n/a |
| <a name="module_efs_csi_irsa_role"></a> [efs\_csi\_irsa\_role](#module\_efs\_csi\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | n/a |
| <a name="module_vpc_cni_irsa_role"></a> [vpc\_cni\_irsa\_role](#module\_vpc\_cni\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | n/a |
Expand Down Expand Up @@ -130,14 +130,13 @@ Change logs are auto-generated with commitizen.
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | EKS cluster name name component used through out the EKS cluster describing its purpose (ex: dice-dev) | `string` | n/a | yes |
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | The Kubernetes version number to use for this EKS cluster. See https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html | `string` | `"1.27"` | no |
| <a name="input_eks_instance_disk_size"></a> [eks\_instance\_disk\_size](#input\_eks\_instance\_disk\_size) | The size of the disk of the worker nodes in gigabytes. 40 is the approximate minimum. Needs to hold the all of the normal operating system files plus every image that will be used in the cluster. | `number` | `80` | no |
| <a name="input_eks_instance_types"></a> [eks\_instance\_types](#input\_eks\_instance\_types) | EKS worker node instance types | `list(string)` | <pre>[<br> "t3.xlarge"<br>]</pre> | no |
| <a name="input_eks_instance_types"></a> [eks\_instance\_types](#input\_eks\_instance\_types) | EKS worker node instance types | `list(string)` | <pre>[<br> "t3.small"<br>]</pre> | no |
| <a name="input_eks_ng_desired_size"></a> [eks\_ng\_desired\_size](#input\_eks\_ng\_desired\_size) | Node Group desired size | `number` | `4` | no |
| <a name="input_eks_ng_max_size"></a> [eks\_ng\_max\_size](#input\_eks\_ng\_max\_size) | Node Group maximum size | `number` | `15` | no |
| <a name="input_eks_ng_min_size"></a> [eks\_ng\_min\_size](#input\_eks\_ng\_min\_size) | Node Group minimum size | `number` | `4` | no |
| <a name="input_enable_cluster_creator_admin_permissions"></a> [enable\_cluster\_creator\_admin\_permissions](#input\_enable\_cluster\_creator\_admin\_permissions) | Indicates whether or not to add the cluster creator (the identity used by Terraform) as an administrator via access entry | `bool` | `false` | no |
| <a name="input_profile"></a> [profile](#input\_profile) | AWS config profile | `string` | `""` | no |
| <a name="input_subnets_name"></a> [subnets\_name](#input\_subnets\_name) | Define the name of the subnets to be used by this cluster | `string` | `"*-container-*"` | no |
| <a name="input_tag_costallocation"></a> [tag\_costallocation](#input\_tag\_costallocation) | Tag CostAllocation (default) | `string` | `"csvd:infrastructure"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | AWS Tags to apply to appropriate resources | `map(string)` | `{}` | no |
| <a name="input_vpc_name"></a> [vpc\_name](#input\_vpc\_name) | Define the VPC name that will be used by this cluster | `string` | n/a | yes |

Expand Down
16 changes: 9 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ data "aws_kms_key" "ebs_key" {
locals {
additional_policies = {}
base_tags = {
"boc:eks-cluster-name" = var.cluster_name
"boc:tf_module_name" = local.module_name
"boc:tf_module_version" = local.module_version
"boc:created_by" = "terraform"
CostAllocation = var.tag_costallocation
"boc:eks-cluster-name" = var.cluster_name
"boc:tf_module_name" = local.module_name
"boc:tf_module_version" = local.module_version
"boc:created_by" = "terragrunt"
"karpenter.sh/discovery" = var.cluster_name
}
max_tag_count = 45
ng_name = format("%v%v-nodegroup", local.prefixes["eks"], var.cluster_name)
Expand All @@ -45,7 +45,7 @@ locals {
}

module "cluster" {
source = "git@github.e.it.census.gov:SCT-Engineering/terraform-aws-eks.git?ref=v20.24.1"
source = "git@github.e.it.census.gov:SCT-Engineering/terraform-aws-eks.git?ref=v20.24.3"

cluster_name = var.cluster_name
cluster_version = var.cluster_version
Expand Down Expand Up @@ -129,9 +129,11 @@ module "cluster" {
}
}
}
labels = {
intent = "control-apps"
}
}
}

tags = local.tags
}

Expand Down
20 changes: 1 addition & 19 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ variable "eks_instance_types" {
description = "EKS worker node instance types"
type = list(string)
default = [
"t3.xlarge"
"t3.small"
]
}

Expand Down Expand Up @@ -79,12 +79,6 @@ variable "census_private_cidr" {
default = ["148.129.0.0/16", "172.16.0.0/12", "192.168.0.0/16"]
}

variable "tag_costallocation" {
description = "Tag CostAllocation (default)"
type = string
default = "csvd:infrastructure"
}

variable "tags" {
description = "AWS Tags to apply to appropriate resources"
type = map(string)
Expand All @@ -96,15 +90,3 @@ variable "profile" {
type = string
default = ""
}

# variable "region" {
# description = "AWS config region"
# type = string
# default = ""
# }

# variable "os_username" {
# description = "OS username from environment variable, ideally as $USER"
# type = string
# default = null
# }

0 comments on commit 9c78898

Please sign in to comment.