Skip to content

Commit 8b6d9dd

Browse files
committed
fix: fix bug in autoscaler
1 parent f2dbe50 commit 8b6d9dd

File tree

11 files changed

+204
-21
lines changed

11 files changed

+204
-21
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Terraform
22
kubeconfig_wrongsecrets-exercise-cluster
33
.terraform
4-
.terraform.lock.hcl
5-
.terraform*
4+
.terraform
65
terraform.tfstate*
6+
.terraform.tfstate*
77
aws/terraform.tfstate.*
88
aws/terraform.tfstate.backup
99
aws/.terraform.tfstate.lock.info

aws/.terraform.lock.hcl

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,18 @@ The documentation below is auto-generated to give insight on what's created via
135135

136136
| Name | Version |
137137
|------|---------|
138-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.1 |
139-
| <a name="provider_http"></a> [http](#provider\_http) | ~> 3.1 |
140-
| <a name="provider_random"></a> [random](#provider\_random) | ~> 3.0 |
138+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.58.0 |
139+
| <a name="provider_http"></a> [http](#provider\_http) | 3.2.1 |
140+
| <a name="provider_random"></a> [random](#provider\_random) | 3.4.3 |
141141

142142
## Modules
143143

144144
| Name | Source | Version |
145145
|------|--------|---------|
146-
| <a name="module_cluster_autoscaler_irsa_role"></a> [cluster\_autoscaler\_irsa\_role](#module\_cluster\_autoscaler\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.9.0 |
147-
| <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 | ~> 5.9.0 |
148-
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 19.7.0 |
149-
| <a name="module_load_balancer_controller_irsa_role"></a> [load\_balancer\_controller\_irsa\_role](#module\_load\_balancer\_controller\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.9.0 |
146+
| <a name="module_cluster_autoscaler_irsa_role"></a> [cluster\_autoscaler\_irsa\_role](#module\_cluster\_autoscaler\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.11.2 |
147+
| <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 | ~> 5.11.2 |
148+
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 19.10.0 |
149+
| <a name="module_load_balancer_controller_irsa_role"></a> [load\_balancer\_controller\_irsa\_role](#module\_load\_balancer\_controller\_irsa\_role) | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | ~> 5.11.2 |
150150
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.19.0 |
151151

152152
## Resources

aws/build-an-deploy-aws.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ CLUSTERNAME="$(terraform output -raw cluster_name)"
4343
STATE_BUCKET="$(terraform output -raw state_bucket_name)"
4444
IRSA_ROLE_ARN="$(terraform output -raw irsa_role_arn)"
4545
EBS_ROLE_ARN="$(terraform output -raw ebs_role_arn)"
46+
CLUSTER_AUTOSCALER_ROLE_ARN="$(terraform output -raw cluster_autoscaler_role_arn)"
4647

4748
echo "CLUSTERNAME=${CLUSTERNAME}"
4849
echo "STATE_BUCKET=${STATE_BUCKET}"
4950
echo "IRSA_ROLE_ARN=${IRSA_ROLE_ARN}"
5051
echo "EBS_ROLE_ARN=${EBS_ROLE_ARN}"
52+
echo "CLUSTER_AUTOSCALER_ROLE_ARN=${CLUSTER_AUTOSCALER_ROLE_ARN}"
5153

5254
version="$(uuidgen)"
5355

@@ -86,8 +88,8 @@ kubectl apply -f cluster-autoscaler-autodiscover.yaml
8688

8789
echo "annotating service account for cluster-autoscaler"
8890
kubectl annotate serviceaccount cluster-autoscaler \
89-
-n kube-system \
90-
eks.amazonaws.com/role-arn=${CLUSTER_AUTOSCALER}
91+
-n kube-system --overwrite \
92+
eks.amazonaws.com/role-arn=${CLUSTER_AUTOSCALER_ROLE_ARN}
9193

9294
kubectl patch deployment cluster-autoscaler \
9395
-n kube-system \

aws/cleanup-aws-autoscaling-and-helm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fi
2424
ACCOUNT_ID=$(aws sts get-caller-identity | jq '.Account' -r)
2525
echo "ACCOUNT_ID=${ACCOUNT_ID}"
2626

27-
kubectl delete -f k8s/wrongsecrets-balancer-ingress.yaml
27+
kubectl delete -f k8s/wrongsecrets-balancer-ingress.yml
2828
kubectl delete -f k8s/ctfd-ingress.yaml
2929

3030
sleep 5 # Give the controller some time to catch the ingress change

aws/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
# Then uncomment and apply!
44
backend "s3" {
55
region = "eu-west-1" # Change if desired
6-
bucket = "terraform-20230105182940038600000001" # Put your bucket name here
6+
bucket = "terraform-20230310093750024400000001" # Put your bucket name here
77
key = "wrongsecrets/terraform.tfstate" # Change if desired
88
}
99
}
@@ -62,7 +62,7 @@ module "vpc" {
6262

6363
module "eks" {
6464
source = "terraform-aws-modules/eks/aws"
65-
version = "19.7.0"
65+
version = "19.10.0"
6666

6767
cluster_name = var.cluster_name
6868
cluster_version = var.cluster_version
@@ -141,7 +141,7 @@ module "eks" {
141141
# Cluster Autoscaler IRSA
142142
module "cluster_autoscaler_irsa_role" {
143143
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
144-
version = "~> 5.9.0"
144+
version = "~> 5.11.2"
145145

146146

147147
role_name = "wrongsecrets-cluster-autoscaler"
@@ -158,7 +158,7 @@ module "cluster_autoscaler_irsa_role" {
158158

159159
module "ebs_csi_irsa_role" {
160160
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
161-
version = "~> 5.9.0"
161+
version = "~> 5.11.2"
162162

163163
role_name = "wrongsecrets-ebs-csi"
164164
attach_ebs_csi_policy = true
@@ -173,7 +173,7 @@ module "ebs_csi_irsa_role" {
173173

174174
module "load_balancer_controller_irsa_role" {
175175
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
176-
version = "~> 5.9.0"
176+
version = "~> 5.11.2"
177177

178178
role_name = "wrongsecrets-load-balancer-controller"
179179
attach_load_balancer_controller_policy = true

aws/outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ output "ebs_role_arn" {
4444
value = module.ebs_csi_irsa_role.iam_role_arn
4545
}
4646

47+
output "cluster_autoscaler_role" {
48+
description = "Cluster autoscaler role"
49+
value = module.cluster_autoscaler_irsa_role.iam_role_name
50+
}
51+
52+
output "cluster_autoscaler_role_arn" {
53+
description = "Cluster autoscaler role arn"
54+
value = module.cluster_autoscaler_irsa_role.iam_role_arn
55+
}
56+
4757
output "state_bucket_name" {
4858
description = "Terraform s3 state bucket name"
4959
value = split(":", var.state_bucket_arn)[length(split(":", var.state_bucket_arn)) - 1]

aws/shared-state/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/shared-state/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The documentation below is auto-generated to give insight on what's created via
1313

1414
| Name | Version |
1515
|------|---------|
16-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.0 |
16+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.57.0 |
1717

1818
## Modules
1919

aws/terraform.tfvars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
cluster_version = "1.23"
2-
region = "eu-west-1"
1+
region = "eu-west-1"
32
# state_bucket_arn = "..."

0 commit comments

Comments
 (0)