Skip to content

Commit

Permalink
Merge pull request #4 from SCT-Engineering/upgrade-version-1.30
Browse files Browse the repository at this point in the history
Upgrade version 1.30
  • Loading branch information
morga471 committed Jun 25, 2024
2 parents 6e16b66 + fa89db7 commit ed641c9
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 36 deletions.
39 changes: 26 additions & 13 deletions cluster_autoscaler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,34 @@ locals {
ng_asg_name = var.eks_managed_node_groups_autoscaling_group_names[0]
}

module "cluster_autoscaler_irsa_role" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
# module "cluster_autoscaler_irsa_role" {
# source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"

role_name = "${var.cluster_name}-cluster-autoscaler"
# role_name = "${var.cluster_name}-cluster-autoscaler"

attach_cluster_autoscaler_policy = true
# attach_cluster_autoscaler_policy = true

cluster_autoscaler_cluster_names = [var.cluster_name]
# cluster_autoscaler_cluster_names = [var.cluster_name]

oidc_providers = {
main = {
provider_arn = var.oidc_provider_arn
namespace_service_accounts = ["kube-system:cluster-autoscaler"]
}
# oidc_providers = {
# main = {
# provider_arn = var.oidc_provider_arn
# namespace_service_accounts = ["kube-system:cluster-autoscaler"]
# }
# }
# tags = local.tags
# }

# ALTERNATELY WE PASS THIS VIA OUTPUT DEPENDENCY W/ TERRAGRUNT
data "aws_iam_role" "cluster_autoscaler_irsa_role" {
name = "${var.cluster_name}-cluster-autoscaler"
}

#### NEED TO MOVE THIS TO A PROPER PLACE
resource "kubernetes_namespace" "operators" {
metadata {
name = var.operators_ns
}
tags = local.tags
}

resource "aws_autoscaling_group_tag" "on-demand" {
Expand Down Expand Up @@ -79,12 +91,13 @@ resource "helm_release" "cluster-autoscaler" {

set {
name = "rbac.serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn"
value = module.cluster_autoscaler_irsa_role.iam_role_arn
value = data.aws_iam_role.cluster_autoscaler_irsa_role.arn
# value = module.cluster_autoscaler_irsa_role.iam_role_arn
}

set {
name = "rbac.serviceAccount.create"
value = "false"
value = "true"
}
}

Expand Down
7 changes: 5 additions & 2 deletions examples/simple/eks-configuration.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module "eks-configuration" {
source = "git@github.it.census.gov:SOA/tfmod-eks-storage-classes.git//"
#source = "git@github.it.census.gov:SOA/tfmod-eks-configuration.git//?ref=v1.0.0"
# source = "git@github.it.census.gov:SOA/tfmod-eks-configuration.git//"
source = "../.."
# source = "git@github.it.census.gov:SOA/tfmod-eks-configuration.git//?ref=v1.0.0"

region = var.region
profile = var.profile
Expand All @@ -12,4 +13,6 @@ module "eks-configuration" {

oidc_provider_arn = var.oidc_provider_arn
eks_managed_node_groups_autoscaling_group_names = var.eks_managed_node_groups_autoscaling_group_names

tags = var.tags
}
33 changes: 23 additions & 10 deletions examples/simple/simple.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# Generally these values originate from or need to match those in tfmod-eks
region = "us-gov-east-1"
profile = "107742151971-do2-govcloud"
cluster_name = "adsd-cumulus-sandbox"
profile = "terraform"
cluster_name = "platform-test-1"

vpc_id = "vpc-0d71dc78076c0e0b3"
vpc_id = "vpc-0280f77b373744eaa"
subnets = [
"subnet-004f46dfe18f4cd53",
"subnet-00dba5a2905c7fe70",
"subnet-0360b208aa4feefd6",
"subnet-078b228071c609a50",
"subnet-02c2250b9ec2dd6a2",
"subnet-07a6339be3670fb41",
]
security_group_all_worker_mgmt_id = "sg-0208882843ec79a56"

oidc_provider_arn = "arn:aws-us-gov:iam::107742151971:oidc-provider/oidc.eks.us-gov-east-1.amazonaws.com/id/7FE48CFA5D16E37DFCCB764674F0A212"
eks_managed_node_groups_autoscaling_group_names = [""]

# These values are outputs of tfmod-eks
security_group_all_worker_mgmt_id = "sg-08d7d5d8cff75c1d3"
oidc_provider_arn = "arn:aws-us-gov:iam::224384469011:oidc-provider/oidc.eks.us-gov-east-1.amazonaws.com/id/EA906CF6F61F76098A45EEE3BA96B161"
eks_managed_node_groups_autoscaling_group_names = ["eks-eks-platform-test-1-nodegroup-20240528141016973700000016-2cc7dfc4-cca4-345f-c0a2-ab63401f0cd9"]

tags = {
project_number = "fs0000000078"
project_name = "csvd_platformbaseline"
project_role = "csvd_platformbaseline_app"
organization = "census:ocio:csvd"
created_by = "luther.coleman.mcginty@census.gov"
created_for = "luther.coleman.mcginty@census.gov"
created_reason = "Testing eks module operation"
Terraform = "true"
Terragrunt = "true"
test_adjustment = "testing adding tags"
}
5 changes: 5 additions & 0 deletions examples/simple/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ variable "oidc_provider_arn" {
type = string
}

variable "tags" {
description = "AWS Tags to apply to appropriate resources"
type = map(string)
default = {}
}
16 changes: 8 additions & 8 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ output "rwx_storage_class" {
################################################################################
# IRSA Roles created
################################################################################
output "cluster_autoscaler_irsa_role" {
description = "The arn/name/unique_id of the irsa role for the cluster autoscaler addon"
value = {
arn = module.cluster_autoscaler_irsa_role.iam_role_arn
name = module.cluster_autoscaler_irsa_role.iam_role_name
unique_id = module.cluster_autoscaler_irsa_role.iam_role_unique_id
}
}
# output "cluster_autoscaler_irsa_role" {
# description = "The arn/name/unique_id of the irsa role for the cluster autoscaler addon"
# value = {
# arn = module.cluster_autoscaler_irsa_role.iam_role_arn
# name = module.cluster_autoscaler_irsa_role.iam_role_name
# unique_id = module.cluster_autoscaler_irsa_role.iam_role_unique_id
# }
# }

################################################################################
# Details about kubectl image
Expand Down
12 changes: 9 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ variable "oidc_provider_arn" {
type = string
}

variable "operators_ns" {
description = "Namespace to create where operators will be installed."
type = string
default = "operators"
}

variable "tag_costallocation" {
description = "Tag CostAllocation (default)"
type = string
Expand All @@ -54,20 +60,20 @@ variable "tags" {
variable "kubectl_image_tag" {
description = "The version of bitnami/kubectl image to use."
type = string
default = "1.27.1"
default = "1.27.14"
}

# helm add repo autoscaler "https://kubernetes.github.io/autoscaler"
# helm search repo -l autoscaler/cluster-autoscaler
variable "cluster_autoscaler_chart_version" {
description = "The helm chart of the cluster-autoscaler most closely matching the Kuberentes version. Review output of `helm add repo autoscaler 'https://kubernetes.github.io/autoscaler'` (if the repo hasn't been added previously) and `helm search repo -l autoscaler/cluster-autoscaler`"
type = string
default = "9.29.3"
default = "9.37.0"
}

# helm show values --version [cluster_autoscaler_chart_version] autoscaler/cluster-autoscaler | grep tag:
variable "cluster_autoscaler_tag" {
description = "Image tag of cluster-autoscaler associated with the cluster_autoscaler_chart_version helm chart. `helm show values --version [cluster_autoscaler_chart_version] autoscaler/cluster-autoscaler | grep tag:`"
type = string
default = "v1.27.2"
default = "v1.30.0"
}

0 comments on commit ed641c9

Please sign in to comment.