Skip to content

Commit 0403bac

Browse files
authored
refactor: do not use templates/alb-ingress-controller-values.yaml and set necessary values in the eks-aws-loadbalancer-controller.tf (#188)
1 parent ddd7d56 commit 0403bac

File tree

3 files changed

+23
-29
lines changed

3 files changed

+23
-29
lines changed

terraform/layer2-k8s/eks-aws-loadbalancer-controller.tf

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,29 @@ locals {
44
enabled = local.helm_releases[index(local.helm_releases.*.id, "aws-load-balancer-controller")].enabled
55
chart = local.helm_releases[index(local.helm_releases.*.id, "aws-load-balancer-controller")].chart
66
repository = local.helm_releases[index(local.helm_releases.*.id, "aws-load-balancer-controller")].repository
7-
chart_version = local.helm_releases[index(local.helm_releases.*.id, "aws-load-balancer-controller")].version
7+
chart_version = local.helm_releases[index(local.helm_releases.*.id, "aws-load-balancer-controller")].chart_version
88
namespace = local.helm_releases[index(local.helm_releases.*.id, "aws-load-balancer-controller")].namespace
99
}
10-
alb_ingress_controller = templatefile("${path.module}/templates/alb-ingress-controller-values.yaml",
11-
{
12-
role_arn = local.aws_load_balancer_controller.enabled ? module.aws_iam_aws_loadbalancer_controller[0].role_arn : "",
13-
region = local.region,
14-
cluster_name = local.eks_cluster_id,
15-
vpc_id = local.vpc_id
16-
})
10+
aws_load_balancer_controller_values = <<VALUES
11+
clusterName: ${local.eks_cluster_id}
12+
region: ${local.region}
13+
vpcId: ${local.eks_cluster_id}
14+
15+
serviceAccount:
16+
create: true
17+
annotations:
18+
"eks.amazonaws.com/role-arn": ${local.aws_load_balancer_controller.enabled ? module.aws_iam_aws_loadbalancer_controller[0].role_arn : ""}
19+
20+
affinity:
21+
nodeAffinity:
22+
requiredDuringSchedulingIgnoredDuringExecution:
23+
nodeSelectorTerms:
24+
- matchExpressions:
25+
- key: eks.amazonaws.com/capacityType
26+
operator: In
27+
values:
28+
- ON_DEMAND
29+
VALUES
1730
}
1831

1932
#tfsec:ignore:kubernetes-network-no-public-egress tfsec:ignore:kubernetes-network-no-public-ingress
@@ -318,7 +331,7 @@ resource "helm_release" "aws_loadbalancer_controller" {
318331
max_history = var.helm_release_history_size
319332

320333
values = [
321-
local.alb_ingress_controller
334+
local.aws_load_balancer_controller_values
322335
]
323336

324337
}

terraform/layer2-k8s/helm-releases.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ releases:
33
enabled: false
44
chart: aws-load-balancer-controller
55
repository: https://aws.github.io/eks-charts
6-
version: 1.2.6
6+
chart_version: 1.2.6
77
namespace: aws-load-balancer-controller
88
- id: aws-node-termination-handler
99
enabled: true

terraform/layer2-k8s/templates/alb-ingress-controller-values.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)